/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'regional';
  @endpointMap = {
    'cn-qingdao' = 'ddosbgp.aliyuncs.com',
    'cn-beijing' = 'ddosbgp.aliyuncs.com',
    'cn-zhangjiakou' = 'ddosbgp.aliyuncs.com',
    'cn-huhehaote' = 'ddosbgp.aliyuncs.com',
    'cn-hangzhou' = 'ddosbgp.aliyuncs.com',
    'cn-shanghai' = 'ddosbgp.aliyuncs.com',
    'cn-shenzhen' = 'ddosbgp.aliyuncs.com',
    'ap-northeast-1' = 'ddosbgp.ap-southeast-1.aliyuncs.com',
    'ap-south-1' = 'ddosbgp.ap-southeast-1.aliyuncs.com',
    'ap-southeast-2' = 'ddosbgp.ap-southeast-1.aliyuncs.com',
    'ap-southeast-3' = 'ddosbgp.ap-southeast-1.aliyuncs.com',
    'ap-southeast-5' = 'ddosbgp.ap-southeast-1.aliyuncs.com',
    'cn-chengdu' = 'ddosbgp.aliyuncs.com',
    'eu-central-1' = 'ddosbgp.ap-southeast-1.aliyuncs.com',
    'eu-west-1' = 'ddosbgp.ap-southeast-1.aliyuncs.com',
    'me-east-1' = 'ddosbgp.ap-southeast-1.aliyuncs.com',
    'cn-hangzhou-finance' = 'ddosbgp.aliyuncs.com',
    'cn-shenzhen-finance-1' = 'ddosbgp.aliyuncs.com',
    'cn-shanghai-finance-1' = 'ddosbgp.aliyuncs.com',
    'cn-north-2-gov-1' = 'ddosbgp.aliyuncs.com',
  };

  checkConfig(config);
  @endpoint = getEndpoint('ddosbgp', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model AddIpRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Anti-DDoS Origin instance.

>  You can call the [DescribeInstanceList](https://help.aliyun.com/document_detail/118698.html) operation to query the IDs of all Anti-DDoS Origin instances.

This parameter is required.', example='ddosbgp-cn-npk1z7t9****'),
  ipList?: string(name='IpList', description='The IP addresses that you want to add to the Anti-DDoS Origin instance. This parameter is a string consisting of JSON arrays. Each element in a JSON array is a JSON struct that includes the following fields:

*   **ip**: required. The IP address that you want to add. Data type: string.
*   **member_uid**: optional. The member to which the asset belongs. Data type: string. This field is required only if the asset of a member is queried. Example: [{"ip":"121.41.XX.XX","member_uid":"120100811162\\\\*\\\\*\\\\*\\\\*"}].

This parameter is required.', example='[{"ip":"1.XX.XX.1"},{"ip":"2.XX.XX.2"}]'),
  regionId?: string(name='RegionId', description='The ID of the region where the Anti-DDoS Origin instance resides.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/118703.html) operation to query the most recent region list.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the Anti-DDoS Origin instance belongs in Resource Management. This parameter is empty by default, which indicates that the Anti-DDoS Origin instance belongs to the default resource group.

For information about resource groups, see [Create a resource group](https://help.aliyun.com/document_detail/94485.html).', example='rg-acfm2pz25js****'),
}

model AddIpResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='C33EB3D5-AF96-43CA-9C7E-37A81BC06A1E'),
}

model AddIpResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AddIpResponseBody(name='body'),
}

/**
 * @summary Adds IP addresses to an Anti-DDoS Origin instance.
 *
 * @param request AddIpRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return AddIpResponse
 */
async function addIpWithOptions(request: AddIpRequest, runtime: Util.RuntimeOptions): AddIpResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.ipList)) {
    query['IpList'] = request.ipList;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AddIp',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Adds IP addresses to an Anti-DDoS Origin instance.
 *
 * @param request AddIpRequest
 * @return AddIpResponse
 */
async function addIp(request: AddIpRequest): AddIpResponse {
  var runtime = new Util.RuntimeOptions{};
  return addIpWithOptions(request, runtime);
}

model AddRdMemberListRequest {
  memberList?: [ 
    {
      uid?: string(name='Uid', description='The Alibaba Cloud account ID of the member.', example='19510843762****'),
    }
  ](name='MemberList', description='The list of the members.

This parameter is required.'),
}

model AddRdMemberListShrinkRequest {
  memberListShrink?: string(name='MemberList', description='The list of the members.

This parameter is required.'),
}

model AddRdMemberListResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='4C467B38-3910-447D-87BC-AC049166F216'),
}

model AddRdMemberListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AddRdMemberListResponseBody(name='body'),
}

/**
 * @summary Adds members to a resource directory.
 *
 * @description Only a delegated administrator account or the management account of a resource directory can be used to add members to the resource directory.
 *
 * @param tmpReq AddRdMemberListRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return AddRdMemberListResponse
 */
async function addRdMemberListWithOptions(tmpReq: AddRdMemberListRequest, runtime: Util.RuntimeOptions): AddRdMemberListResponse {
  Util.validateModel(tmpReq);
  var request = new AddRdMemberListShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.memberList)) {
    request.memberListShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.memberList, 'MemberList', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.memberListShrink)) {
    query['MemberList'] = request.memberListShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AddRdMemberList',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Adds members to a resource directory.
 *
 * @description Only a delegated administrator account or the management account of a resource directory can be used to add members to the resource directory.
 *
 * @param request AddRdMemberListRequest
 * @return AddRdMemberListResponse
 */
async function addRdMemberList(request: AddRdMemberListRequest): AddRdMemberListResponse {
  var runtime = new Util.RuntimeOptions{};
  return addRdMemberListWithOptions(request, runtime);
}

model AttachAssetGroupToInstanceRequest {
  assetGroupList?: [ 
    {
      memberUid?: string(name='MemberUid', description='The UID of the member to which the asset belongs.', example='1743970208320***'),
      name?: string(name='Name', description='The ID of the asset that you want to add. If the asset is a Web Application Firewall (WAF) instance, specify the ID of the WAF instance.

This parameter is required.', example='waf-test-001'),
      region?: string(name='Region', description='The region ID of the asset.

This parameter is required.', example='cn-hangzhou'),
      type?: string(name='Type', description='The type of the asset.

This parameter is required.', example='waf'),
    }
  ](name='AssetGroupList', description='The information about the asset to be associated.

This parameter is required.'),
  instanceId?: string(name='InstanceId', description='The ID of the instance to query.

>  You can call the [DescribeInstanceList](https://help.aliyun.com/document_detail/118698.html) operation to query the IDs of all Anti-DDoS Origin instances of paid editions.

This parameter is required.', example='ddosbgp-cn-n6w1r7nz****'),
  regionId?: string(name='RegionId', description='The ID of the region in which the instance resides.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/118703.html) operation to query the most recent region list.', example='cn-hangzhou'),
}

model AttachAssetGroupToInstanceShrinkRequest {
  assetGroupListShrink?: string(name='AssetGroupList', description='The information about the asset to be associated.

This parameter is required.'),
  instanceId?: string(name='InstanceId', description='The ID of the instance to query.

>  You can call the [DescribeInstanceList](https://help.aliyun.com/document_detail/118698.html) operation to query the IDs of all Anti-DDoS Origin instances of paid editions.

This parameter is required.', example='ddosbgp-cn-n6w1r7nz****'),
  regionId?: string(name='RegionId', description='The ID of the region in which the instance resides.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/118703.html) operation to query the most recent region list.', example='cn-hangzhou'),
}

model AttachAssetGroupToInstanceResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='52B49F64-5A36-5CE0-BD00-765792C26AA9'),
}

model AttachAssetGroupToInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AttachAssetGroupToInstanceResponseBody(name='body'),
}

/**
 * @summary Associates an asset with an Anti-DDoS Origin instance of a paid edition.
 *
 * @param tmpReq AttachAssetGroupToInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return AttachAssetGroupToInstanceResponse
 */
async function attachAssetGroupToInstanceWithOptions(tmpReq: AttachAssetGroupToInstanceRequest, runtime: Util.RuntimeOptions): AttachAssetGroupToInstanceResponse {
  Util.validateModel(tmpReq);
  var request = new AttachAssetGroupToInstanceShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.assetGroupList)) {
    request.assetGroupListShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.assetGroupList, 'AssetGroupList', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.assetGroupListShrink)) {
    query['AssetGroupList'] = request.assetGroupListShrink;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AttachAssetGroupToInstance',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Associates an asset with an Anti-DDoS Origin instance of a paid edition.
 *
 * @param request AttachAssetGroupToInstanceRequest
 * @return AttachAssetGroupToInstanceResponse
 */
async function attachAssetGroupToInstance(request: AttachAssetGroupToInstanceRequest): AttachAssetGroupToInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return attachAssetGroupToInstanceWithOptions(request, runtime);
}

model AttachToPolicyRequest {
  ipPortProtocolList?: [ 
    {
      ip?: string(name='Ip', description='The IP address of the protected object.

This parameter is required.', example='112.124.241.***'),
      port?: int32(name='Port', description='The port number of the protected object.

>  This parameter is available for only port-specific mitigation policies.', example='8*'),
      protocol?: string(name='Protocol', description='The protocol type of the protected object. Valid values:

*   **tcp**
*   **udp**

>  This parameter is available for only port-specific mitigation policies.', example='tcp'),
    }
  ](name='IpPortProtocolList', description='The protected objects.

This parameter is required.'),
  policyId?: string(name='PolicyId', description='The policy ID.

This parameter is required.', example='cd8b4d70-e4e0-413a-b390-e71d********'),
}

model AttachToPolicyShrinkRequest {
  ipPortProtocolListShrink?: string(name='IpPortProtocolList', description='The protected objects.

This parameter is required.'),
  policyId?: string(name='PolicyId', description='The policy ID.

This parameter is required.', example='cd8b4d70-e4e0-413a-b390-e71d********'),
}

model AttachToPolicyResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='DC245DEE-9800-5579-BF99-189D6A5****'),
}

model AttachToPolicyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AttachToPolicyResponseBody(name='body'),
}

/**
 * @summary Associates a mitigation policy to a protected object.
 *
 * @param tmpReq AttachToPolicyRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return AttachToPolicyResponse
 */
async function attachToPolicyWithOptions(tmpReq: AttachToPolicyRequest, runtime: Util.RuntimeOptions): AttachToPolicyResponse {
  Util.validateModel(tmpReq);
  var request = new AttachToPolicyShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.ipPortProtocolList)) {
    request.ipPortProtocolListShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.ipPortProtocolList, 'IpPortProtocolList', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.ipPortProtocolListShrink)) {
    query['IpPortProtocolList'] = request.ipPortProtocolListShrink;
  }
  if (!Util.isUnset(request.policyId)) {
    query['PolicyId'] = request.policyId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AttachToPolicy',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Associates a mitigation policy to a protected object.
 *
 * @param request AttachToPolicyRequest
 * @return AttachToPolicyResponse
 */
async function attachToPolicy(request: AttachToPolicyRequest): AttachToPolicyResponse {
  var runtime = new Util.RuntimeOptions{};
  return attachToPolicyWithOptions(request, runtime);
}

model CheckAccessLogAuthRequest {
  regionId?: string(name='RegionId', description='The ID of the region where the Anti-DDoS Origin instance resides.

For more information about the valid values of this parameter, see [Regions and zones](https://help.aliyun.com/document_detail/188196.html).', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the Anti-DDoS Origin instance belongs in Resource Management. This parameter is empty by default, which indicates that the Anti-DDoS Origin instance belongs to the default resource group.

For more information about resource groups, see [Create a resource group](https://help.aliyun.com/document_detail/94485.html).', example='rg-acfm2pz25js****'),
}

model CheckAccessLogAuthResponseBody = {
  accessLogAuth?: boolean(name='AccessLogAuth', description='Indicates whether Anti-DDoS Origin was authorized to access Simple Log Service. Valid values:

*   **true**
*   **false**', example='true'),
  requestId?: string(name='RequestId', description='The request ID.', example='864FE2F4-CB2E-4024-B9EF-D59FD08ABD41'),
}

model CheckAccessLogAuthResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CheckAccessLogAuthResponseBody(name='body'),
}

/**
 * @summary Queries whether Anti-DDoS Origin is authorized to access Simple Log Service.
 *
 * @param request CheckAccessLogAuthRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CheckAccessLogAuthResponse
 */
async function checkAccessLogAuthWithOptions(request: CheckAccessLogAuthRequest, runtime: Util.RuntimeOptions): CheckAccessLogAuthResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CheckAccessLogAuth',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries whether Anti-DDoS Origin is authorized to access Simple Log Service.
 *
 * @param request CheckAccessLogAuthRequest
 * @return CheckAccessLogAuthResponse
 */
async function checkAccessLogAuth(request: CheckAccessLogAuthRequest): CheckAccessLogAuthResponse {
  var runtime = new Util.RuntimeOptions{};
  return checkAccessLogAuthWithOptions(request, runtime);
}

model CheckGrantRequest {
  isSlr?: boolean(name='IsSlr', description='Specifies whether to allow Anti-DDoS Origin to check the service-linked role. Valid values:

*   **true**
*   **false**', example='true'),
  regionId?: string(name='RegionId', description='The ID of the region where the Anti-DDoS Origin instance resides.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/118703.html) operation to query the most recent region list.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the Anti-DDoS Origin instance belongs in Resource Management.

If you do not specify this parameter, the instance belongs to the default resource group.', example='rg-acfm2pz25js****'),
}

model CheckGrantResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='DB002CE5-5E6C-5F11-AE15-B525299A40F6'),
  status?: int32(name='Status', description='Indicates whether Anti-DDoS Origin is authorized to obtain information about the assets within the current Alibaba Cloud account. Valid values:

*   **1**: Anti-DDoS Origin is authorized to obtain information about the assets within the current Alibaba Cloud account.
*   **0**: Anti-DDoS Origin is not authorized to obtain information about the assets within the current Alibaba Cloud account.', example='1'),
}

model CheckGrantResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CheckGrantResponseBody(name='body'),
}

/**
 * @summary Queries whether Anti-DDoS Origin is authorized to obtain information about the assets within the current Alibaba Cloud account.
 *
 * @description You can call the CheckGrant operation to query whether Anti-DDoS Origin is authorized to obtain information about the assets within the current Alibaba Cloud account.
 * ### Limits
 * You can call this operation up to 10 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request CheckGrantRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CheckGrantResponse
 */
async function checkGrantWithOptions(request: CheckGrantRequest, runtime: Util.RuntimeOptions): CheckGrantResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CheckGrant',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries whether Anti-DDoS Origin is authorized to obtain information about the assets within the current Alibaba Cloud account.
 *
 * @description You can call the CheckGrant operation to query whether Anti-DDoS Origin is authorized to obtain information about the assets within the current Alibaba Cloud account.
 * ### Limits
 * You can call this operation up to 10 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request CheckGrantRequest
 * @return CheckGrantResponse
 */
async function checkGrant(request: CheckGrantRequest): CheckGrantResponse {
  var runtime = new Util.RuntimeOptions{};
  return checkGrantWithOptions(request, runtime);
}

model ConfigSchedruleOnDemandRequest {
  instanceId?: string(name='InstanceId', description='The ID of the on-demand instance.

>  You can call the [DescribeOnDemandInstance](https://help.aliyun.com/document_detail/152120.html) operation to query the IDs of all on-demand instances.

This parameter is required.', example='ddosbgp-cn-z2q1qzxb****'),
  regionId?: string(name='RegionId', description='The region ID of the on-demand instance.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/118703.html) operation to query the most recent region list.', example='cn-zhangjiakou'),
  ruleAction?: string(name='RuleAction', description='The scheduling action. Set the value to **declare**, which indicates that the route is advertised.

This parameter is required.', example='declare'),
  ruleConditionCnt?: string(name='RuleConditionCnt', description='If the inbound bandwidth or packets consecutively exceed the threshold for the specified number of times, the scheduling rule is triggered and traffic is rerouted to the on-demand instance. The specified number of times is the value of this parameter.

>  The threshold of inbound bandwidth is the value of **RuleConditionMbps**. The threshold of inbound packets is the value of **RuleConditionKpps**.

This parameter is required.', example='3'),
  ruleConditionKpps?: string(name='RuleConditionKpps', description='The threshold of inbound packets. Unit: kilo packets per second (Kpps). Minimum value: **10**.

This parameter is required.', example='10'),
  ruleConditionMbps?: string(name='RuleConditionMbps', description='The threshold of inbound bandwidth. Unit: Mbit/s. Minimum value: **100**.

This parameter is required.', example='100'),
  ruleName?: string(name='RuleName', description='The name of the scheduling rule.

The name can contain lowercase letters, digits, hyphens (-), and underscores (_). The name can be up to 32 characters in length. We recommend that you use the ID of the on-demand instance as the name. Example: `ddosbgp-cn-z2q1qzxb****`.

This parameter is required.', example='ddosbgp-cn-z2q1qzxb****'),
  ruleSwitch?: string(name='RuleSwitch', description='Specifies whether the scheduling rule is enabled. Valid values:

*   **on**
*   **off**

This parameter is required.', example='on'),
  ruleUndoBeginTime?: string(name='RuleUndoBeginTime', description='The start time of the period during which the scheduling rule is automatically stopped. The time must be in the 24-hour clock and in the `hh:mm` format.

If the system detects that DDoS attacks stop, the system no longer reroutes traffic to the on-demand instance from the time you specified. We recommend that you set this parameter to a value that is defined as off-peak hours.

>  This parameter takes effect only when the value of **RuleUndoMode** is **auto**.

This parameter is required.', example='03:00'),
  ruleUndoEndTime?: string(name='RuleUndoEndTime', description='The end time of the period during which the scheduling rule is automatically stopped. The time must be in the 24-hour clock and in the `hh:mm` format.', example='03:05'),
  ruleUndoMode?: string(name='RuleUndoMode', description='The stop method of the scheduling rule. Valid values:

*   **auto**
*   **manual**

This parameter is required.', example='manual'),
  timeZone?: string(name='TimeZone', description='The time zone of the time when the scheduling rule automatically stops. The time zone must be in the `GMT-hh:mm` format.

For example, the value `GMT-08:00` indicates that the time zone is UTC+8.

>  This parameter takes effect only when the value of **RuleUndoMode** is **auto**.

This parameter is required.', example='GMT-08:00'),
}

model ConfigSchedruleOnDemandResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='BD06F539-2FBE-450D-9391-7EFF787128F5'),
}

model ConfigSchedruleOnDemandResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ConfigSchedruleOnDemandResponseBody(name='body'),
}

/**
 * @summary Modifies a scheduling rule of an anti-DDoS diversion instance.
 *
 * @param request ConfigSchedruleOnDemandRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ConfigSchedruleOnDemandResponse
 */
async function configSchedruleOnDemandWithOptions(request: ConfigSchedruleOnDemandRequest, runtime: Util.RuntimeOptions): ConfigSchedruleOnDemandResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.ruleAction)) {
    query['RuleAction'] = request.ruleAction;
  }
  if (!Util.isUnset(request.ruleConditionCnt)) {
    query['RuleConditionCnt'] = request.ruleConditionCnt;
  }
  if (!Util.isUnset(request.ruleConditionKpps)) {
    query['RuleConditionKpps'] = request.ruleConditionKpps;
  }
  if (!Util.isUnset(request.ruleConditionMbps)) {
    query['RuleConditionMbps'] = request.ruleConditionMbps;
  }
  if (!Util.isUnset(request.ruleName)) {
    query['RuleName'] = request.ruleName;
  }
  if (!Util.isUnset(request.ruleSwitch)) {
    query['RuleSwitch'] = request.ruleSwitch;
  }
  if (!Util.isUnset(request.ruleUndoBeginTime)) {
    query['RuleUndoBeginTime'] = request.ruleUndoBeginTime;
  }
  if (!Util.isUnset(request.ruleUndoEndTime)) {
    query['RuleUndoEndTime'] = request.ruleUndoEndTime;
  }
  if (!Util.isUnset(request.ruleUndoMode)) {
    query['RuleUndoMode'] = request.ruleUndoMode;
  }
  if (!Util.isUnset(request.timeZone)) {
    query['TimeZone'] = request.timeZone;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ConfigSchedruleOnDemand',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies a scheduling rule of an anti-DDoS diversion instance.
 *
 * @param request ConfigSchedruleOnDemandRequest
 * @return ConfigSchedruleOnDemandResponse
 */
async function configSchedruleOnDemand(request: ConfigSchedruleOnDemandRequest): ConfigSchedruleOnDemandResponse {
  var runtime = new Util.RuntimeOptions{};
  return configSchedruleOnDemandWithOptions(request, runtime);
}

model CreatePolicyRequest {
  name?: string(name='Name', description='The name of the policy.

This parameter is required.', example='test'),
  type?: string(name='Type', description='The type of the policy. Valid values:

*   **l3**: IP-specific mitigation policies.
*   **l4**: port-specific mitigation policies.

This parameter is required.', example='l3'),
}

model CreatePolicyResponseBody = {
  id?: string(name='Id', description='The ID of the policy.', example='83967609-7ea5-4f6d-a6ea-380b09e****'),
  requestId?: string(name='RequestId', description='The request ID.', example='864FE2F4-CB2E-4024-B9EF-D59FD08A****'),
}

model CreatePolicyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreatePolicyResponseBody(name='body'),
}

/**
 * @summary Creates a mitigation policy.
 *
 * @param request CreatePolicyRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreatePolicyResponse
 */
async function createPolicyWithOptions(request: CreatePolicyRequest, runtime: Util.RuntimeOptions): CreatePolicyResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreatePolicy',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates a mitigation policy.
 *
 * @param request CreatePolicyRequest
 * @return CreatePolicyResponse
 */
async function createPolicy(request: CreatePolicyRequest): CreatePolicyResponse {
  var runtime = new Util.RuntimeOptions{};
  return createPolicyWithOptions(request, runtime);
}

model CreateSchedruleOnDemandRequest {
  instanceId?: string(name='InstanceId', description='The ID of the on-demand instance.

>  You can call the [DescribeOnDemandInstance](https://help.aliyun.com/document_detail/152120.html) operation to query the IDs of all on-demand instances.

This parameter is required.', example='ddosbgp-cn-z2q1qzxb****'),
  regionId?: string(name='RegionId', description='The region ID of the on-demand instance.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/118703.html) operation to query the most recent region list.', example='cn-zhangjiakou'),
  ruleAction?: string(name='RuleAction', description='The scheduling action. Set the value to **declare**, which indicates that the route is advertised.

This parameter is required.', example='declare'),
  ruleConditionCnt?: string(name='RuleConditionCnt', description='If the inbound bandwidth or packets consecutively exceed the threshold for the specified number of times, the scheduling rule is triggered and traffic is rerouted to the on-demand instance. The specified number of times is the value of this parameter.

>  The threshold of inbound bandwidth is the value of **RuleConditionMbps**. The threshold of inbound packets is the value of **RuleConditionKpps**.

This parameter is required.', example='3'),
  ruleConditionKpps?: string(name='RuleConditionKpps', description='The threshold of inbound packets. Unit: kilo packets per second (Kpps). Minimum value: **10**.

This parameter is required.', example='10'),
  ruleConditionMbps?: string(name='RuleConditionMbps', description='The threshold of inbound bandwidth. Unit: Mbit/s. Minimum value: **100**.

This parameter is required.', example='100'),
  ruleName?: string(name='RuleName', description='The name of the scheduling rule.

The name can contain lowercase letters, digits, hyphens (-), and underscores (_). The name can be up to 32 characters in length. We recommend that you use the ID of the on-demand instance as the name. Example: `ddosbgp-cn-z2q1qzxb****`.

This parameter is required.', example='ddosbgp-cn-z2q1qzxb****'),
  ruleSwitch?: string(name='RuleSwitch', description='Specifies whether the scheduling rule is enabled. Valid values:

*   **on**
*   **off**

This parameter is required.', example='on'),
  ruleUndoBeginTime?: string(name='RuleUndoBeginTime', description='The start time of the period during which the scheduling rule is automatically stopped. The time must be in the 24-hour clock and in the `hh:mm` format.

If the system detects that DDoS attacks stop, the system no longer reroutes traffic to the on-demand instance from the time you specified. We recommend that you set this parameter to a value that is defined as off-peak hours.

>  This parameter takes effect only when the value of **RuleUndoMode** is **auto**.

This parameter is required.', example='03:00'),
  ruleUndoEndTime?: string(name='RuleUndoEndTime', description='The end time of the period during which the scheduling rule is automatically stopped. The time must be in the 24-hour clock and in the `hh:mm` format.', example='03:05'),
  ruleUndoMode?: string(name='RuleUndoMode', description='The stop method of the scheduling rule. Valid values:

*   **auto**
*   **manual**

This parameter is required.', example='auto'),
  timeZone?: string(name='TimeZone', description='The time zone of the time when the scheduling rule automatically stops. The time zone must be in the `GMT-hh:mm` format.

For example, the value `GMT-08:00` indicates that the time zone is UTC+8.

>  This parameter takes effect only when the value of **RuleUndoMode** is **auto**.

This parameter is required.', example='GMT-08:00'),
}

model CreateSchedruleOnDemandResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='BD06F539-2FBE-450D-9391-7EFF787128F5'),
}

model CreateSchedruleOnDemandResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateSchedruleOnDemandResponseBody(name='body'),
}

/**
 * @summary Creates a scheduling rule for an anti-DDoS diversion instance.
 *
 * @param request CreateSchedruleOnDemandRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateSchedruleOnDemandResponse
 */
async function createSchedruleOnDemandWithOptions(request: CreateSchedruleOnDemandRequest, runtime: Util.RuntimeOptions): CreateSchedruleOnDemandResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.ruleAction)) {
    query['RuleAction'] = request.ruleAction;
  }
  if (!Util.isUnset(request.ruleConditionCnt)) {
    query['RuleConditionCnt'] = request.ruleConditionCnt;
  }
  if (!Util.isUnset(request.ruleConditionKpps)) {
    query['RuleConditionKpps'] = request.ruleConditionKpps;
  }
  if (!Util.isUnset(request.ruleConditionMbps)) {
    query['RuleConditionMbps'] = request.ruleConditionMbps;
  }
  if (!Util.isUnset(request.ruleName)) {
    query['RuleName'] = request.ruleName;
  }
  if (!Util.isUnset(request.ruleSwitch)) {
    query['RuleSwitch'] = request.ruleSwitch;
  }
  if (!Util.isUnset(request.ruleUndoBeginTime)) {
    query['RuleUndoBeginTime'] = request.ruleUndoBeginTime;
  }
  if (!Util.isUnset(request.ruleUndoEndTime)) {
    query['RuleUndoEndTime'] = request.ruleUndoEndTime;
  }
  if (!Util.isUnset(request.ruleUndoMode)) {
    query['RuleUndoMode'] = request.ruleUndoMode;
  }
  if (!Util.isUnset(request.timeZone)) {
    query['TimeZone'] = request.timeZone;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateSchedruleOnDemand',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates a scheduling rule for an anti-DDoS diversion instance.
 *
 * @param request CreateSchedruleOnDemandRequest
 * @return CreateSchedruleOnDemandResponse
 */
async function createSchedruleOnDemand(request: CreateSchedruleOnDemandRequest): CreateSchedruleOnDemandResponse {
  var runtime = new Util.RuntimeOptions{};
  return createSchedruleOnDemandWithOptions(request, runtime);
}

model DeleteBlackholeRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Anti-DDoS Origin instance.

>  You can call the [DescribeInstanceList](https://help.aliyun.com/document_detail/118698.html) operation to query the IDs of all Anti-DDoS Origin instances.

This parameter is required.', example='ddosbgp-cn-n6w1r7nz****'),
  ip?: string(name='Ip', description='The IP address for which you want to deactivate blackhole filtering.

>  You can call the [DescribePackIpList](https://help.aliyun.com/document_detail/118701.html) operation to query all the IP addresses that are protected by the Anti-DDoS Origin instance and the protection status of the IP addresses. For example, you can query whether blackhole filtering is triggered for an IP address.

This parameter is required.', example='47.89.XX.XX'),
  regionId?: string(name='RegionId', description='The ID of the region where the Anti-DDoS Origin instance resides.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/118703.html) operation to query the most recent region list.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the Anti-DDoS Origin instance belongs in Resource Management.

If you do not specify this parameter, the instance belongs to the default resource group.', example='rg-acfm2pz25js****'),
}

model DeleteBlackholeResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='C33EB3D5-AF96-43CA-9C7E-37A81BC06A1E'),
}

model DeleteBlackholeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteBlackholeResponseBody(name='body'),
}

/**
 * @summary Deactivates blackhole filtering for a protected IP address.
 *
 * @description You can call the DeleteBlackhole operation to deactivate blackhole filtering for a protected IP address.
 * Before you call this operation, you can call the [DescribePackIpList](https://help.aliyun.com/document_detail/118701.html) operation to query the protection status of the IP addresses that are protected by your Anti-DDoS Origin instance. For example, you can query whether blackhole filtering is triggered for an IP address.
 * ### [](#qps-)Limits
 * You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DeleteBlackholeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteBlackholeResponse
 */
async function deleteBlackholeWithOptions(request: DeleteBlackholeRequest, runtime: Util.RuntimeOptions): DeleteBlackholeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.ip)) {
    query['Ip'] = request.ip;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteBlackhole',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deactivates blackhole filtering for a protected IP address.
 *
 * @description You can call the DeleteBlackhole operation to deactivate blackhole filtering for a protected IP address.
 * Before you call this operation, you can call the [DescribePackIpList](https://help.aliyun.com/document_detail/118701.html) operation to query the protection status of the IP addresses that are protected by your Anti-DDoS Origin instance. For example, you can query whether blackhole filtering is triggered for an IP address.
 * ### [](#qps-)Limits
 * You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DeleteBlackholeRequest
 * @return DeleteBlackholeResponse
 */
async function deleteBlackhole(request: DeleteBlackholeRequest): DeleteBlackholeResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteBlackholeWithOptions(request, runtime);
}

model DeleteIpRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Anti-DDoS Origin instance.

>  You can call the [DescribeInstanceList](https://help.aliyun.com/document_detail/118698.html) operation to query the IDs of all Anti-DDoS Origin instances.

This parameter is required.', example='ddosbgp-cn-npk1z7t9****'),
  ipList?: string(name='IpList', description='The IP addresses that you want to remove from the Anti-DDoS Origin instance. This parameter is a string that consists of JSON arrays. Each element in a JSON array is a JSON struct that contains the following fields:

*   **ip**: required. The IP address that you want to remove. Data type: string.

    **

    **Note** The IP addresses that you want to remove must be protected by the Anti-DDoS Origin instance.

This parameter is required.', example='[{"ip":"1.XX.XX.1"},{"ip":"2.XX.XX.2"}]'),
  regionId?: string(name='RegionId', description='The ID of the region where the Anti-DDoS Origin instance resides.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/118703.html) operation to query the most recent region list.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the Anti-DDoS Origin instance belongs in Resource Management. This parameter is empty by default, which indicates that the Anti-DDoS Origin instance belongs to the default resource group.

For information about resource groups, see [Create a resource group](https://help.aliyun.com/document_detail/94485.html).', example='rg-acfm2pz25js****'),
}

model DeleteIpResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='C33EB3D5-AF96-43CA-9C7E-37A81BC06A1E'),
}

model DeleteIpResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteIpResponseBody(name='body'),
}

/**
 * @summary Removes specific IP addresses from an Anti-DDoS Origin instance.
 *
 * @description The Anti-DDoS Origin Enterprise instance no longer protects the IP addresses that are removed.
 *
 * @param request DeleteIpRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteIpResponse
 */
async function deleteIpWithOptions(request: DeleteIpRequest, runtime: Util.RuntimeOptions): DeleteIpResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.ipList)) {
    query['IpList'] = request.ipList;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteIp',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Removes specific IP addresses from an Anti-DDoS Origin instance.
 *
 * @description The Anti-DDoS Origin Enterprise instance no longer protects the IP addresses that are removed.
 *
 * @param request DeleteIpRequest
 * @return DeleteIpResponse
 */
async function deleteIp(request: DeleteIpRequest): DeleteIpResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteIpWithOptions(request, runtime);
}

model DeletePolicyRequest {
  id?: string(name='Id', description='The ID of the policy.

This parameter is required.', example='90300b1a-ced8-4437-b4bf-f9a5*******'),
}

model DeletePolicyResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='BD06F539-2FBE-450D-9391-7EFF7871****'),
}

model DeletePolicyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeletePolicyResponseBody(name='body'),
}

/**
 * @summary Deletes a mitigation policy.
 *
 * @description You cannot delete a mitigation policy to which a protected object is added.
 *
 * @param request DeletePolicyRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeletePolicyResponse
 */
async function deletePolicyWithOptions(request: DeletePolicyRequest, runtime: Util.RuntimeOptions): DeletePolicyResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.id)) {
    query['Id'] = request.id;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeletePolicy',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes a mitigation policy.
 *
 * @description You cannot delete a mitigation policy to which a protected object is added.
 *
 * @param request DeletePolicyRequest
 * @return DeletePolicyResponse
 */
async function deletePolicy(request: DeletePolicyRequest): DeletePolicyResponse {
  var runtime = new Util.RuntimeOptions{};
  return deletePolicyWithOptions(request, runtime);
}

model DeleteRdMemberListRequest {
  memberList?: [ 
    {
      uid?: string(name='Uid', description='The Alibaba Cloud account ID of the member.', example='136548010379****'),
    }
  ](name='MemberList', description='The list of the members.

This parameter is required.'),
}

model DeleteRdMemberListShrinkRequest {
  memberListShrink?: string(name='MemberList', description='The list of the members.

This parameter is required.'),
}

model DeleteRdMemberListResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='A2D6D5FB-FA07-41A8-B093-A2B7B26E72F2'),
}

model DeleteRdMemberListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteRdMemberListResponseBody(name='body'),
}

/**
 * @summary Deletes members.
 *
 * @description Only a delegated administrator account or the management account of a resource directory can be used to delete members.
 *
 * @param tmpReq DeleteRdMemberListRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteRdMemberListResponse
 */
async function deleteRdMemberListWithOptions(tmpReq: DeleteRdMemberListRequest, runtime: Util.RuntimeOptions): DeleteRdMemberListResponse {
  Util.validateModel(tmpReq);
  var request = new DeleteRdMemberListShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.memberList)) {
    request.memberListShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.memberList, 'MemberList', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.memberListShrink)) {
    query['MemberList'] = request.memberListShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteRdMemberList',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes members.
 *
 * @description Only a delegated administrator account or the management account of a resource directory can be used to delete members.
 *
 * @param request DeleteRdMemberListRequest
 * @return DeleteRdMemberListResponse
 */
async function deleteRdMemberList(request: DeleteRdMemberListRequest): DeleteRdMemberListResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteRdMemberListWithOptions(request, runtime);
}

model DeleteSchedruleOnDemandRequest {
  instanceId?: string(name='InstanceId', description='The ID of the anti-DDoS diversion instance.

>  You can call the [DescribeOnDemandInstance](https://help.aliyun.com/document_detail/152120.html) operation to query the IDs of all anti-DDoS diversion instances.

This parameter is required.', example='ddosbgp-cn-z2q1qzxb****'),
  regionId?: string(name='RegionId', description='The region ID of the anti-DDoS diversion instance.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/118703.html) operation to query the most recent region list.', example='cn-zhangjiakou'),
  ruleName?: string(name='RuleName', description='The name of the scheduling rule that you want to delete.

This parameter is required.', example='testrule'),
}

model DeleteSchedruleOnDemandResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='BD06F539-2FBE-450D-9391-7EFF787128F5'),
}

model DeleteSchedruleOnDemandResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteSchedruleOnDemandResponseBody(name='body'),
}

/**
 * @summary Deletes a scheduling rule of an anti-DDoS diversion instance.
 *
 * @param request DeleteSchedruleOnDemandRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteSchedruleOnDemandResponse
 */
async function deleteSchedruleOnDemandWithOptions(request: DeleteSchedruleOnDemandRequest, runtime: Util.RuntimeOptions): DeleteSchedruleOnDemandResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.ruleName)) {
    query['RuleName'] = request.ruleName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteSchedruleOnDemand',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes a scheduling rule of an anti-DDoS diversion instance.
 *
 * @param request DeleteSchedruleOnDemandRequest
 * @return DeleteSchedruleOnDemandResponse
 */
async function deleteSchedruleOnDemand(request: DeleteSchedruleOnDemandRequest): DeleteSchedruleOnDemandResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteSchedruleOnDemandWithOptions(request, runtime);
}

model DescribeAssetGroupRequest {
  name?: string(name='Name', description='The ID of the asset. If the asset is a Web Application Firewall (WAF) instance, specify the ID of the WAF instance.', example='waf_v2_public_cn-lbj382l****'),
  region?: string(name='Region', description='The region ID of the asset.

This parameter is required.', example='cn-hangzhou'),
  regionId?: string(name='RegionId', description='The ID of the region in which the instance resides.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/118703.html) operation to query the most recent region list.', example='cn-hangzhou'),
  type?: string(name='Type', description='The type of the asset. Valid values:

*   **waf**: WAF instance
*   **ga**: Global Accelerator (GA) instance

This parameter is required.', example='waf'),
}

model DescribeAssetGroupResponseBody = {
  assetGroupList?: [ 
    {
      name?: string(name='Name', description='The ID of the asset.', example='waf_v2_public_cn-lbj382l****'),
      region?: string(name='Region', description='The region to which the asset belongs.', example='cn-hangzhou'),
      type?: string(name='Type', description='The type of the asset.', example='waf'),
    }
  ](name='AssetGroupList', description='The information about the asset.'),
  requestId?: string(name='RequestId', description='The request ID.', example='487EC0F7-8D14-504E-914E-3A1BC314B581'),
  total?: long(name='Total', description='The total number of entries returned.', example='2'),
}

model DescribeAssetGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeAssetGroupResponseBody(name='body'),
}

/**
 * @summary Queries the association between an asset and an Anti-DDoS Origin instance of a paid edition.
 *
 * @param request DescribeAssetGroupRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeAssetGroupResponse
 */
async function describeAssetGroupWithOptions(request: DescribeAssetGroupRequest, runtime: Util.RuntimeOptions): DescribeAssetGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeAssetGroup',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the association between an asset and an Anti-DDoS Origin instance of a paid edition.
 *
 * @param request DescribeAssetGroupRequest
 * @return DescribeAssetGroupResponse
 */
async function describeAssetGroup(request: DescribeAssetGroupRequest): DescribeAssetGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeAssetGroupWithOptions(request, runtime);
}

model DescribeAssetGroupToInstanceRequest {
  instanceId?: string(name='InstanceId', description='The ID of the instance to query.

>  You can call the [DescribeInstanceList](https://help.aliyun.com/document_detail/118698.html) operation to query the IDs of all Anti-DDoS Origin instances of paid editions.', example='ddosbgp-cn-7212zaa5v***'),
  memberUid?: string(name='MemberUid', description='The UID of the member to which the asset belongs.', example='170858869679****'),
  name?: string(name='Name', description='The ID of the asset. If the asset is a Web Application Firewall (WAF) instance, specify the ID of the WAF instance.', example='waf_v2_public_cn-lbj382l****'),
  region?: string(name='Region', description='The region ID of the asset.', example='cn-hangzhou'),
  regionId?: string(name='RegionId', description='The ID of the region in which the instance resides.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/118703.html) operation to query the most recent region list.', example='cn-hangzhou'),
  type?: string(name='Type', description='The type of the asset. Valid values:

*   **waf**: WAF instance
*   **ga**: Global Accelerator (GA) instance', example='waf'),
}

model DescribeAssetGroupToInstanceResponseBody = {
  dataList?: [ 
    {
      instanceId?: string(name='InstanceId', description='The ID of the Anti-DDoS Origin instance of a paid edition.', example='ddosbgp-cn-7212zaa5v***'),
      memberUid?: string(name='MemberUid', description='The UID of the member to which the asset belongs.', example='170858869679****'),
      name?: string(name='Name', description='The ID of the asset.', example='waf_v2_public_cn-lbj382l****'),
      region?: string(name='Region', description='The region ID of the asset.', example='cn-hangzhou'),
      type?: string(name='Type', description='The type of the asset.', example='waf'),
    }
  ](name='DataList', description='The response parameters.'),
  requestId?: string(name='RequestId', description='The request ID.', example='C73C59B9-9F5C-57FF-A394-13EC8FC3B2FF'),
  total?: long(name='Total', description='The total number of entries returned.', example='1'),
}

model DescribeAssetGroupToInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeAssetGroupToInstanceResponseBody(name='body'),
}

/**
 * @summary Queries the association between an asset and an Anti-DDoS Origin instance of a paid edition.
 *
 * @param request DescribeAssetGroupToInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeAssetGroupToInstanceResponse
 */
async function describeAssetGroupToInstanceWithOptions(request: DescribeAssetGroupToInstanceRequest, runtime: Util.RuntimeOptions): DescribeAssetGroupToInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.memberUid)) {
    query['MemberUid'] = request.memberUid;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeAssetGroupToInstance',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the association between an asset and an Anti-DDoS Origin instance of a paid edition.
 *
 * @param request DescribeAssetGroupToInstanceRequest
 * @return DescribeAssetGroupToInstanceResponse
 */
async function describeAssetGroupToInstance(request: DescribeAssetGroupToInstanceRequest): DescribeAssetGroupToInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeAssetGroupToInstanceWithOptions(request, runtime);
}

model DescribeDdosEventRequest {
  endTime?: int32(name='EndTime', description='The end time of the DDoS attack events to query. This value is a UNIX timestamp. Unit: seconds.

This parameter is required.', example='1638288000'),
  instanceId?: string(name='InstanceId', description='The ID of the Anti-DDoS Origin instance to query.

>  You can call the [DescribeInstanceList](https://help.aliyun.com/document_detail/118698.html) operation to query the IDs of all Anti-DDoS Origin instances.

This parameter is required.', example='ddosbgp-cn-n6w1r7nz****'),
  ip?: string(name='Ip', description='The attacked IP address to query.', example='47.89.XX.XX'),
  pageNo?: int32(name='PageNo', description='The page number.

This parameter is required.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.

This parameter is required.', example='10'),
  regionId?: string(name='RegionId', description='The ID of the region where the Anti-DDoS Origin instance resides.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/118703.html) operation to query the most recent region list.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the Anti-DDoS Origin instance belongs in Resource Management.

If you do not specify this parameter, the instance belongs to the default resource group.', example='rg-acfm2pz25js****'),
  startTime?: int32(name='StartTime', description='The start time of the DDoS attack events to query. This value is a UNIX timestamp. Unit: seconds.

This parameter is required.', example='1633017600'),
}

model DescribeDdosEventResponseBody = {
  events?: [ 
    {
      endTime?: int32(name='EndTime', description='The time when the DDoS attack stopped. This value is a UNIX timestamp. Unit: seconds.', example='1637554335'),
      ip?: string(name='Ip', description='The attacked IP address.', example='47.89.XX.XX'),
      mbps?: int32(name='Mbps', description='The volume of the request traffic at the start of the DDoS attack. Unit: Mbit/s.', example='0'),
      pps?: int32(name='Pps', description='The number of packets at the start of the DDoS attack. Unit: packets per second (PPS).', example='456'),
      startTime?: int32(name='StartTime', description='The time when the DDoS attack started. This value is a UNIX timestamp. Unit: seconds.', example='1637554034'),
      status?: string(name='Status', description='The status of the DDoS attack event. Valid values:

*   **hole_begin**: indicates that blackhole filtering is triggered for the attacked IP address.
*   **hole_end**: indicates that blackhole filtering is deactivated for the attacked IP address.
*   **defense_begin**: indicates that attack traffic is being scrubbed.
*   **defense_end**: indicates that attack traffic is scrubbed.', example='defense_end'),
    }
  ](name='Events', description='The details about the DDoS attack event.'),
  requestId?: string(name='RequestId', description='The request ID.', example='F3B6C3F9-6B21-519D-B976-A1E14166F909'),
  total?: long(name='Total', description='The total number of DDoS attack events that are returned.', example='1'),
}

model DescribeDdosEventResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDdosEventResponseBody(name='body'),
}

/**
 * @summary Queries the details about the DDoS attack events that occurred on an Anti-DDoS Origin instance.
 *
 * @description You can call the DescribeDdosEvent operation to query the details about the DDoS attack events that occurred on an Anti-DDoS Origin instance by page. The details include the start time, end time, attacked IP address, and status of each event.
 * ### [](#qps-)Limits
 * You can call this operation up to 10 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeDdosEventRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDdosEventResponse
 */
async function describeDdosEventWithOptions(request: DescribeDdosEventRequest, runtime: Util.RuntimeOptions): DescribeDdosEventResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.ip)) {
    query['Ip'] = request.ip;
  }
  if (!Util.isUnset(request.pageNo)) {
    query['PageNo'] = request.pageNo;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDdosEvent',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the details about the DDoS attack events that occurred on an Anti-DDoS Origin instance.
 *
 * @description You can call the DescribeDdosEvent operation to query the details about the DDoS attack events that occurred on an Anti-DDoS Origin instance by page. The details include the start time, end time, attacked IP address, and status of each event.
 * ### [](#qps-)Limits
 * You can call this operation up to 10 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeDdosEventRequest
 * @return DescribeDdosEventResponse
 */
async function describeDdosEvent(request: DescribeDdosEventRequest): DescribeDdosEventResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDdosEventWithOptions(request, runtime);
}

model DescribeDdosOriginInstanceBillRequest {
  endTime?: long(name='EndTime', description='The end of the time range to query. The value is a timestamp. Unit: milliseconds. The time span between StartTime and EndTime cannot exceed 30 days.', example='1711382399410'),
  isShowList?: boolean(name='IsShowList', description='Specifies whether to display the bill details. Valid values:

*   **true**
*   **false**', example='false'),
  startTime?: long(name='StartTime', description='The beginning of the time range to query. The value is a timestamp. Unit: milliseconds.', example='1711209600410'),
  type?: string(name='Type', description='The bill type. Valid values:

*   **flow_cn**: the bill for the clean bandwidth of elastic IP addresses (EIPs) with Anti-DDoS (Enhanced) enabled in the Chinese mainland.
*   **flow_ov**: the bill for the clean bandwidth of EIPs with Anti-DDoS (Enhanced) enabled outside the Chinese mainland.
*   **standard_assets_flow_cn**: the bill for the clean bandwidth of regular Alibaba Cloud services in the Chinese mainland.
*   **standard_assets_flow_ov**: the bill for the clean bandwidth of regular Alibaba Cloud services outside the Chinese mainland.
*   **function**: the bill for the basic fee.
*   **ip_count**: the bill for protected IP addresses.
*   **monthly_summary**: the monthly summary bill.', example='function'),
}

model DescribeDdosOriginInstanceBillResponseBody = {
  assetStatus?: int32(name='AssetStatus', description='The asset status.

*   **0**: No asset is added to the instance for protection.
*   **1**: Assets are added to the instance for protection.', example='0'),
  debtStatus?: long(name='DebtStatus', description='The payment status. Valid values:

*   **0**: The payment is not overdue.
*   **1**: The payment is overdue.', example='0'),
  flowList?: [ 
    {
      memberFlow?: string(name='MemberFlow', description='The traffic distribution by region. The JSON struct contains the following fields:

*   **bytes**: the traffic volume of EIPs with Anti-DDoS (Enhanced) enabled in a region. Unit: bytes.
*   **memberUid**: the owner account.
*   **instanceId**: the ID of the pay-as-you-go instance that protects the EIPs with Anti-DDoS (Enhanced) enabled.
*   **ip**: the EIPs with Anti-DDoS (Enhanced) enabled.
*   **region**: the region.

>  If the memberUid field in the JSON struct is empty, the information about the current account is returned. The value of the bytes parameter in the outermost level of the JSON struct indicates the total traffic, and the values of the bytes parameters in inner levels indicate the traffic of the account.', example='[{\\\\"bytes\\\\":79282719,\\\\"memberUid\\\\":\\\\"\\\\",\\\\"regionFlows\\\\":{\\\\"cn-hangzhou\\\\":[{\\\\"bytes\\\\":79282719,\\\\"instanceId\\\\":\\\\"ddosorigin_cn-u7c3lcr9r02\\\\",\\\\"ip\\\\":\\\\"47.118.168.57\\\\",\\\\"region\\\\":\\\\"cn-hangzhou\\\\"}]}}]'),
      regionFlow?: string(name='RegionFlow', description='The traffic distribution by region. The JSON struct contains the following fields:

*   **bytes**: the traffic volume of EIPs with Anti-DDoS (Enhanced) enabled in a region. Unit: bytes.
*   **instanceId**: the ID of the pay-as-you-go instance that protects the EIPs with Anti-DDoS (Enhanced) enabled.
*   **ip**: the EIPs with Anti-DDoS (Enhanced) enabled.
*   **region**: the region.', example='{\\\\"cn-hangzhou\\\\":[{\\\\"bytes\\\\":0,\\\\"instanceId\\\\":\\\\"ddosorigin_cn-u7c3lcr9r02\\\\",\\\\"ip\\\\":\\\\"47.118.168.124\\\\",\\\\"region\\\\":\\\\"cn-hangzhou\\\\"}]}'),
      time?: long(name='Time', description='The timestamp. Unit: milliseconds.', example='1620951900'),
      totalBillFlow?: long(name='TotalBillFlow'),
      totalFlow?: long(name='TotalFlow', description='The traffic of EIPs with Anti-DDoS (Enhanced) enabled. Unit: bytes.', example='6302081067'),
    }
  ](name='FlowList', description='The details about the traffic of EIPs with Anti-DDoS (Enhanced) enabled.'),
  flowRegion?: map[string]any(name='FlowRegion', description='The traffic distribution of EIPs with Anti-DDoS (Enhanced) enabled by region.', example='{\\\\"cn-hongkong\\\\": 166491566}'),
  instanceId?: string(name='InstanceId', description='The ID of the Anti-DDoS Origin (Pay-as-you-go) instance to query.', example='ddosorigin_cn-u7c3lcr9r02'),
  ipCount?: long(name='IpCount', description='The number of protected IP addresses.', example='15'),
  ipCountOrFunctionList?: [ 
    {
      coverage?: string(name='Coverage', description='The application scope of the instance. Valid values:

*   **only_mainland_china**: regions in the Chinese mainland.
*   **global**: all regions.
*   **international_and_hmt**: regions outside the Chinese mainland.', example='global'),
      ipCntCn?: long(name='IpCntCn', description='The number of IP addresses protected by the pay-as-you-go instance in the Chinese mainland.', example='5'),
      ipCntOv?: long(name='IpCntOv', description='The number of IP addresses protected by the pay-as-you-go instance outside the Chinese mainland.', example='5'),
      memberIpCnt?: string(name='MemberIpCnt', description='The bill distribution by account. The JSON struct contains the following fields:

*   **eipCnIpCount**: the number of EIPs with Anti-DDoS (Enhanced) enabled in the Chinese mainland.
*   **eipOvIpCount**: the number of EIPs with Anti-DDoS (Enhanced) enabled outside the Chinese mainland.
*   **memberUid**: the owner account.
*   **standardAssetsCnIpCount**: the number of IP addresses of regular Alibaba Cloud services in the Chinese mainland.
*   **standardAssetsOvIpCount**: the number of IP addresses of regular Alibaba Cloud services outside the Chinese mainland.

>  If the memberUid field in the JSON struct is empty, the information about the current account is returned.', example='[{\\\\"eipCnIpCount\\\\":3,\\\\"eipOvIpCount\\\\":18,\\\\"memberUid\\\\":\\\\"\\\\",\\\\"standardAssetsCnIpCount\\\\":2,\\\\"standardAssetsOvIpCount\\\\":0},{\\\\"eipCnIpCount\\\\":3,\\\\"eipOvIpCount\\\\":0,\\\\"memberUid\\\\":\\\\"1776997906319249\\\\",\\\\"standardAssetsCnIpCount\\\\":0,\\\\"standardAssetsOvIpCount\\\\":0}]'),
      time?: long(name='Time', description='The billing time. Unit: milliseconds.', example='1680278400000'),
    }
  ](name='IpCountOrFunctionList', description='The protected IP addresses and enabled features.'),
  ipInfo?: string(name='IpInfo', description='The IP address distribution. The JSON struct contains the following fields:

*   **eipCnIpCount**: the number of EIPs with Anti-DDoS (Enhanced) enabled in the Chinese mainland.
*   **eipOvIpCount**: the number of EIPs with Anti-DDoS (Enhanced) enabled outside the Chinese mainland.
*   **standardAssetsCnIpCount**: the number of IP addresses of regular Alibaba Cloud services in the Chinese mainland.
*   **standardAssetsOvIpCount**: the number of IP addresses of regular Alibaba Cloud services outside the Chinese mainland.', example='{\\\\"eipCnIpCount\\\\":6,\\\\"eipOvIpCount\\\\":17,\\\\"standardAssetsCnIpCount\\\\":2,\\\\"standardAssetsOvIpCount\\\\":0}'),
  monthlySummaryList?: [ 
    {
      enableDays?: int32(name='EnableDays', description='The number of days that the instance is activated.', example='30'),
      flowCn?: long(name='FlowCn', description='The total traffic of EIPs with Anti-DDoS (Enhanced) enabled in the Chinese mainland. Unit: bytes.', example='123456'),
      flowIntl?: long(name='FlowIntl', description='The total traffic of EIPs with Anti-DDoS (Enhanced) enabled outside the Chinese mainland. Unit: bytes.', example='123456'),
      ipCountCn?: int32(name='IpCountCn', description='The total number of protected IP addresses in the Chinese mainland.

>  The total number of protected IP addresses is the sum of the daily numbers of protected IP addresses in a month.', example='28'),
      ipCountIntl?: int32(name='IpCountIntl', description='The total number of protected IP addresses outside the Chinese mainland.

>  The total number of protected IP addresses is the sum of the daily numbers of protected IP addresses in a month.', example='30'),
      memberUid?: string(name='MemberUid', description='The ID of the member.', example='112873971277****'),
      standardAssetsFlowCn?: long(name='StandardAssetsFlowCn', description='The total traffic of regular Alibaba Cloud services in the Chinese mainland. Unit: bytes.', example='123456'),
      standardAssetsFlowIntl?: long(name='StandardAssetsFlowIntl', description='The total traffic of regular Alibaba Cloud services outside the Chinese mainland. Unit: bytes.', example='123456'),
      uid?: string(name='Uid', description='The ID of the administrator account.', example='102518028277****'),
    }
  ](name='MonthlySummaryList', description='The information about the monthly summary bills.'),
  requestId?: string(name='RequestId', description='The request ID.', example='72155560-F343-55C8-82FE-ED4D7E4AA97E'),
  standardAssetsFlowList?: [ 
    {
      memberFlow?: string(name='MemberFlow', description='The traffic distribution by region. The JSON struct contains the following fields:

*   **bytes**: the traffic volume of regular Alibaba Cloud services in a region. Unit: bytes.
*   **memberUid**: the owner account.
*   **instanceId**: the ID of the pay-as-you-go instance that protects the regular Alibaba Cloud services.
*   **ip**: the IP address of the regular Alibaba Cloud service protected by the Anti-DDoS Origin instance.
*   **region**: the region.

>  If the memberUid field in the JSON struct is empty, the information about the current account is returned. The value of the bytes parameter in the outermost level of the JSON struct indicates the total traffic, and the values of the bytes parameters in inner levels indicate the traffic of the account.', example='[{\\\\"bytes\\\\":79282719,\\\\"memberUid\\\\":\\\\"\\\\",\\\\"regionFlows\\\\":{\\\\"cn-hangzhou\\\\":[{\\\\"bytes\\\\":79282719,\\\\"instanceId\\\\":\\\\"ddosorigin_cn-u7c3lcr9r02\\\\",\\\\"ip\\\\":\\\\"47.118.168.57\\\\",\\\\"region\\\\":\\\\"cn-hangzhou\\\\"}]}}]'),
      regionFlow?: string(name='RegionFlow', description='The traffic distribution by region. The JSON struct contains the following fields:

*   **bytes**: the traffic volume of regular Alibaba Cloud services in a region. Unit: bytes.
*   **instanceId**: the ID of the pay-as-you-go instance that protects the regular Alibaba Cloud services.
*   **ip**: the IP address protected by the Anti-DDoS Origin instance.
*   **region**: the region.', example='{\\\\"cn-hangzhou\\\\":[{\\\\"bytes\\\\":0,\\\\"instanceId\\\\":\\\\"ddosorigin_cn-u7c3lcr9r02\\\\",\\\\"ip\\\\":\\\\"47.118.168.124\\\\",\\\\"region\\\\":\\\\"cn-hangzhou\\\\"}]}'),
      time?: long(name='Time', description='The timestamp. Unit: milliseconds.', example='1679846400000'),
      totalFlow?: long(name='TotalFlow', description='The traffic of regular Alibaba Cloud services. Unit: bytes.', example='6302081067'),
    }
  ](name='StandardAssetsFlowList', description='The details about the traffic of regular Alibaba Cloud services.'),
  standardAssetsFlowRegion?: map[string]any(name='StandardAssetsFlowRegion', description='The traffic distribution of regular Alibaba Cloud services by region.', example='{\\\\"cn-hongkong\\\\": 166491566}'),
  standardAssetsTotalFlowCn?: long(name='StandardAssetsTotalFlowCn', description='The total traffic of regular Alibaba Cloud services in the Chinese mainland in the current month.', example='0'),
  standardAssetsTotalFlowOv?: long(name='StandardAssetsTotalFlowOv', description='The total traffic of regular Alibaba Cloud services outside the Chinese mainland in the current month.', example='0'),
  status?: long(name='Status', description='The instance status. Valid values:

*   **1**: normal
*   **2**: expired
*   **3**: released', example='1'),
  totalFlowCn?: long(name='TotalFlowCn', description='The total traffic of EIPs with Anti-DDoS (Enhanced) enabled in the Chinese mainland in the current month. Unit: bytes.', example='6302081067'),
  totalFlowOv?: long(name='TotalFlowOv', description='The total traffic of EIPs with Anti-DDoS (Enhanced) enabled outside the Chinese mainland in the current month. Unit: bytes.', example='6204918019'),
}

model DescribeDdosOriginInstanceBillResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDdosOriginInstanceBillResponseBody(name='body'),
}

/**
 * @summary Queries the bill of an Anti-DDoS Origin (Pay-as-you-go) instance.
 *
 * @param request DescribeDdosOriginInstanceBillRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDdosOriginInstanceBillResponse
 */
async function describeDdosOriginInstanceBillWithOptions(request: DescribeDdosOriginInstanceBillRequest, runtime: Util.RuntimeOptions): DescribeDdosOriginInstanceBillResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.isShowList)) {
    query['IsShowList'] = request.isShowList;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDdosOriginInstanceBill',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the bill of an Anti-DDoS Origin (Pay-as-you-go) instance.
 *
 * @param request DescribeDdosOriginInstanceBillRequest
 * @return DescribeDdosOriginInstanceBillResponse
 */
async function describeDdosOriginInstanceBill(request: DescribeDdosOriginInstanceBillRequest): DescribeDdosOriginInstanceBillResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDdosOriginInstanceBillWithOptions(request, runtime);
}

model DescribeExcpetionCountRequest {
  regionId?: string(name='RegionId', description='The ID of the region where the Anti-DDoS Origin instance resides.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/118703.html) operation to query the most recent region list.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the Anti-DDoS Origin instance belongs in Resource Management.

If you do not specify this parameter, the instance belongs to the default resource group.', example='rg-acfm2pz25js****'),
}

model DescribeExcpetionCountResponseBody = {
  exceptionIpCount?: int32(name='ExceptionIpCount', description='The number of assets that are in an abnormal state.', example='0'),
  expireTimeCount?: int32(name='ExpireTimeCount', description='The number of Anti-DDoS Origin instances that are about to expire.', example='1'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='4B45279A-B1BE-5EEE-87CA-58AF4183EA58'),
}

model DescribeExcpetionCountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeExcpetionCountResponseBody(name='body'),
}

/**
 * @summary Queries the number of assets that are in an abnormal state and the number of Anti-DDoS Origin instances that are about to expire. The assets can be elastic IP addresses (EIPs). The assets can also be Elastic Compute Service (ECS) instances or Server Load Balancer (SLB) instances that are assigned public IP addresses.
 *
 * @description ## Usage notes
 * You can call the DescribeExcpetionCount operation to query the number of assets that are in an abnormal state and the number of Anti-DDoS Origin instances that are about to expire in a specific region. For example, if blackhole filtering is triggered for an IP address, the IP address is in an abnormal state. An instance whose remaining validity period is less than seven days is considered as an instance that is about to expire.
 *
 * @param request DescribeExcpetionCountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeExcpetionCountResponse
 */
async function describeExcpetionCountWithOptions(request: DescribeExcpetionCountRequest, runtime: Util.RuntimeOptions): DescribeExcpetionCountResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeExcpetionCount',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the number of assets that are in an abnormal state and the number of Anti-DDoS Origin instances that are about to expire. The assets can be elastic IP addresses (EIPs). The assets can also be Elastic Compute Service (ECS) instances or Server Load Balancer (SLB) instances that are assigned public IP addresses.
 *
 * @description ## Usage notes
 * You can call the DescribeExcpetionCount operation to query the number of assets that are in an abnormal state and the number of Anti-DDoS Origin instances that are about to expire in a specific region. For example, if blackhole filtering is triggered for an IP address, the IP address is in an abnormal state. An instance whose remaining validity period is less than seven days is considered as an instance that is about to expire.
 *
 * @param request DescribeExcpetionCountRequest
 * @return DescribeExcpetionCountResponse
 */
async function describeExcpetionCount(request: DescribeExcpetionCountRequest): DescribeExcpetionCountResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeExcpetionCountWithOptions(request, runtime);
}

model DescribeInstanceListRequest {
  instanceIdList?: string(name='InstanceIdList', description='The number of the page to return.', example='["ddosbgp-cn-oew1pjrk****"]'),
  instanceType?: string(name='InstanceType', description='The field that is used to sort the Anti-DDoS Origin instances. Set the value to **expireTime**, which indicates that the instances are sorted based on the expiration time.

You can set the **Orderdire** parameter to specify the sorting method.', example='0'),
  instanceTypeList?: [ string ](name='InstanceTypeList', description='The total number of Anti-DDoS Origin instances.'),
  ip?: string(name='Ip', description='The sorting method. Valid values:

*   **desc**: the descending order. This is the default value.
*   **asc**: the ascending order.', example='47.89.XX.XX'),
  ipVersion?: string(name='IpVersion', description='The IP address of the object that is protected by the Anti-DDoS Origin instance to query.', example='IPv4'),
  orderby?: string(name='Orderby', description='The ID of the region where the Anti-DDoS Origin instance to query resides.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/118703.html) operation to query the most recent region list.', example='expireTime'),
  orderdire?: string(name='Orderdire', description='The tags that are added to the Anti-DDoS Origin instance.', example='desc'),
  pageNo?: int32(name='PageNo', description='The protocol type of the IP address asset that is protected by the Anti-DDoS Origin instance to query. Valid values:

*   **Ipv4**: IPv4
*   **Ipv6**: IPv6

This parameter is required.', example='1'),
  pageSize?: int32(name='PageSize', description='The mitigation plan of the Anti-DDoS Origin instance to query. Valid values:

*   **0**: the Professional mitigation plan
*   **1**: the Enterprise mitigation plan

This parameter is required.', example='10'),
  regionId?: string(name='RegionId', description='The tag that is added to the Anti-DDoS Origin instance.', example='cn-hangzhou'),
  remark?: string(name='Remark', description='The number of entries to return on each page.', example='test'),
  resourceGroupId?: string(name='ResourceGroupId', description='The remarks of the Anti-DDoS Origin instance to query. Fuzzy match is supported.', example='rg-acfm2pz25js****'),
  tag?: [ 
    {
      key?: string(name='Key', description='The mitigation plan of the Anti-DDoS Origin instance.', example='test-key'),
      value?: string(name='Value', description='The mitigation plan of the Anti-DDoS Origin instance. Valid values:

*   0: the Professional mitigation plan.
*   1: the Enterprise mitigation plan.', example='test-value'),
    }
  ](name='Tag', description='The key of the tag that is added to the Anti-DDoS Origin instance.'),
}

model DescribeInstanceListResponseBody = {
  instanceList?: [ 
    {
      autoProtectCondition?: {
        events?: [ string ](name='Events', description='Events which result in auto binding.'),
      }(name='AutoProtectCondition', description='The event that triggers automatic association. Valid values:

*   **any**: The instance is automatically associated with an object based on traffic scrubbing events or blackhole filtering events.
*   **clean**: The instance is automatically associated with an object based on traffic scrubbing events.
*   **blackhole**: The instance is automatically associated with an object based on blackhole filtering events.'),
      autoRenewal?: boolean(name='AutoRenewal', description='The time when the instance expires. The value is a UNIX timestamp. Unit: milliseconds.', example='false'),
      blackholdingCount?: string(name='BlackholdingCount', description='The type of the instance.

*   **ddos_ddosorigin_public_cn**: Anti-DDoS Origin 2.0 (Pay-as-you-go) on the China site (aliyun.com).
*   **ddos_ddosorigin_public_intl**: Anti-DDoS Origin 2.0 (Pay-as-you-go) on the International site (alibabacloud.com).', example='0'),
      commodityType?: string(name='CommodityType', description='The condition that triggers automatic association of the instance with an object.', example='ddos_ddosorigin_public_cn'),
      coverageType?: int32(name='CoverageType', description='Indicates whether overdue payments exist. Valid values:

*   **0**: Overdue payments do not exist.
*   **1**: Overdue payments exist.', example='1'),
      debtStatus?: long(name='DebtStatus', description='The events that trigger automatic association.', example='0'),
      expireTime?: long(name='ExpireTime', description='The time when the instance was purchased. The value is a UNIX timestamp. Unit: milliseconds.', example='1640275200000'),
      gmtCreate?: long(name='GmtCreate', description='The mitigation plan of the instance. Valid values:

*   **0**: the Professional mitigation plan
*   **1**: the Enterprise mitigation plan', example='1592886047000'),
      instanceId?: string(name='InstanceId', description='The number of protected public IP addresses for which blackhole filtering is triggered.

>  You can call the [DeleteBlackhole](https://help.aliyun.com/document_detail/118692.html) operation to deactivate blackhole filtering for a protected IP address.', example='ddosbgp-cn-oew1pjrk****'),
      instanceType?: string(name='InstanceType', description='The application scope of the instance.

*   **1**: The instance supports public IP addresses in all regions.
*   **2**: The instance supports public IP addresses in regions in the Chinese mainland.
*   **3**: The instance supports public IP addresses in regions outside the Chinese mainland.
*   **4**: The instance supports public IP addresses in a region in or outside the Chinese mainland.', example='1'),
      ipType?: string(name='IpType', description='The description of the instance.', example='IPv4'),
      product?: string(name='Product', description='The ID of the instance.', example='gamebox'),
      remark?: string(name='Remark', description='The type of the cloud service that is associated with the Anti-DDoS Origin instance By default, this parameter is not returned. If the Anti-DDoS Origin instance is created by using a different cloud service, the code of the cloud service is returned.

Valid values:

*   **gamebox**: The Anti-DDoS Origin instance is created by using Game Security Box.
*   **eip**: The Anti-DDoS Origin instance is created by using an elastic IP address (EIP) for which Anti-DDoS (Enhanced Edition) is enabled.', example='test'),
      resourceGroupId?: string(name='ResourceGroupId', description='The resource group ID.', example='rg-aek3ccjxxxxx'),
      status?: string(name='Status', description='Indicates whether auto-renewal is enabled for the instance. Valid values:

*   **true**
*   **false**', example='1'),
    }
  ](name='InstanceList', description='The details about the Anti-DDoS Origin instances.'),
  requestId?: string(name='RequestId', description='The details about the Anti-DDoS Origin instance.', example='381D5D33-BB8F-395F-8EE4-AE3BB4B523C4'),
  total?: long(name='Total', description='The details about the Anti-DDoS Origin instances.', example='1'),
}

model DescribeInstanceListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeInstanceListResponseBody(name='body'),
}

/**
 * @summary Queries the details of all Anti-DDoS Origin instances.
 *
 * @description Queries the details of all Anti-DDoS Origin instances.
 *
 * @param request DescribeInstanceListRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeInstanceListResponse
 */
async function describeInstanceListWithOptions(request: DescribeInstanceListRequest, runtime: Util.RuntimeOptions): DescribeInstanceListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceIdList)) {
    query['InstanceIdList'] = request.instanceIdList;
  }
  if (!Util.isUnset(request.instanceType)) {
    query['InstanceType'] = request.instanceType;
  }
  if (!Util.isUnset(request.instanceTypeList)) {
    query['InstanceTypeList'] = request.instanceTypeList;
  }
  if (!Util.isUnset(request.ip)) {
    query['Ip'] = request.ip;
  }
  if (!Util.isUnset(request.ipVersion)) {
    query['IpVersion'] = request.ipVersion;
  }
  if (!Util.isUnset(request.orderby)) {
    query['Orderby'] = request.orderby;
  }
  if (!Util.isUnset(request.orderdire)) {
    query['Orderdire'] = request.orderdire;
  }
  if (!Util.isUnset(request.pageNo)) {
    query['PageNo'] = request.pageNo;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.remark)) {
    query['Remark'] = request.remark;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeInstanceList',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the details of all Anti-DDoS Origin instances.
 *
 * @description Queries the details of all Anti-DDoS Origin instances.
 *
 * @param request DescribeInstanceListRequest
 * @return DescribeInstanceListResponse
 */
async function describeInstanceList(request: DescribeInstanceListRequest): DescribeInstanceListResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeInstanceListWithOptions(request, runtime);
}

model DescribeInstanceSpecsRequest {
  instanceIdList?: string(name='InstanceIdList', description='The ID of the Anti-DDoS Origin instance. This parameter is a string that consists of JSON arrays. Each element in a JSON array indicates an instance ID. If you want to query more than one instance, separate instance IDs with commas (,).

>  You can call the [DescribeInstanceList](https://help.aliyun.com/document_detail/118698.html) operation to query the IDs of all Anti-DDoS Origin instances in a specific region.

This parameter is required.', example='["ddosbgp-cn-n6w1r7nz****"]'),
  regionId?: string(name='RegionId', description='The region ID of the Anti-DDoS Origin instance. Default value: **cn-hangzhou**, which indicates the China (Hangzhou) region.

>  If your instance does not reside in the China (Hangzhou) region, you must set this parameter to the region ID of your instance. You can call the [DescribeRegions](https://help.aliyun.com/document_detail/118703.html) operation to query the regions of assets that can be protected by Anti-DDoS Origin in a specific region.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the Anti-DDoS Origin instance belongs in Resource Management. This parameter is empty by default, which indicates that the Anti-DDoS Origin instance belongs to the default resource group.

For information about resource groups, see [Create a resource group](https://help.aliyun.com/document_detail/94485.html).', example='rg-acfm2pz25js****'),
}

model DescribeInstanceSpecsResponseBody = {
  instanceSpecs?: [ 
    {
      availableDefenseTimes?: int32(name='AvailableDefenseTimes', description='The available best-effort protection sessions.', example='2'),
      availableDeleteBlackholeCount?: string(name='AvailableDeleteBlackholeCount', description='The number of times that blackhole filtering can be deactivated.', example='100'),
      defenseTimesPercent?: int32(name='DefenseTimesPercent', description='The percentage of the used best-effort protection sessions. Unit: %.', example='30'),
      downgradeStatus?: int32(name='DowngradeStatus', description='Indicates whether the instance is downgraded. Valid value:

*   **8**: The instance is downgraded due to excessive bandwidth usage.', example='8'),
      instanceId?: string(name='InstanceId', description='The ID of the Anti-DDoS Origin instance.', example='ddosbgp-cn-n6w1r7nz****'),
      isFullDefenseMode?: int32(name='IsFullDefenseMode', description='Indicates whether best-effort protection is enabled. Valid values:

*   **0**: Best-effort protection is disabled.
*   **1**: Best-effort protection is enabled.', example='1'),
      packConfig?: {
        bandwidth?: long(name='Bandwidth', description='The bandwidth. Unit: Gbit/s.', example='2'),
        bindIpCount?: int32(name='BindIpCount', description='The number of IP addresses that are protected by the Anti-DDoS Origin Enterprise instance.', example='0'),
        elasticBwMbps?: int32(name='ElasticBwMbps', description='The burstable clean bandwidth. Unit: Mbit/s.', example='100'),
        elasticBwMode?: string(name='ElasticBwMode', description='The metering method of burstable clean bandwidth. Valid values:

*   **month**: the monthly 95th percentile metering method.
*   **day**: the daily 95th percentile metering method.', example='day'),
        ipAdvanceThre?: int32(name='IpAdvanceThre', description='The burstable protection bandwidth of each protected IP address. Unit: Gbit/s.', example='300'),
        ipBasicThre?: int32(name='IpBasicThre', description='The basic protection bandwidth of each protected IP address. Unit: Gbit/s.', example='20'),
        ipSpec?: int32(name='IpSpec', description='The number of IP addresses that can be protected by the Anti-DDoS Origin Enterprise instance.', example='100'),
        normalBandwidth?: int32(name='NormalBandwidth', description='The clean bandwidth. Unit: Mbit/s.', example='200'),
        packAdvThre?: int32(name='PackAdvThre', description='The burstable protection bandwidth of the Anti-DDoS Origin instance. Unit: Gbit/s.', example='300'),
        packBasicThre?: int32(name='PackBasicThre', description='The basic protection bandwidth of the Anti-DDoS Origin instance. Unit: Gbit/s.', example='20'),
      }(name='PackConfig', description='The configurations of the Anti-DDoS Origin instance, including the number of protected IP addresses and protection bandwidth.'),
      region?: string(name='Region', description='The region ID of the Anti-DDoS Origin instance.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/118703.html) operation to query the name of the region.', example='cn-hangzhou'),
      totalDefenseTimes?: int32(name='TotalDefenseTimes', description='The total best-effort protection sessions.', example='2'),
    }
  ](name='InstanceSpecs', description='The specifications of the Anti-DDoS Origin instance, including whether best-effort protection is enabled, the number of available best-effort protection sessions, and the number of used best-effort protection sessions.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='5840AB9F-1419-4620-807D-5EA476090247'),
}

model DescribeInstanceSpecsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeInstanceSpecsResponseBody(name='body'),
}

/**
 * @summary Queries the specifications of a specific Anti-DDoS Origin instance.
 *
 * @param request DescribeInstanceSpecsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeInstanceSpecsResponse
 */
async function describeInstanceSpecsWithOptions(request: DescribeInstanceSpecsRequest, runtime: Util.RuntimeOptions): DescribeInstanceSpecsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceIdList)) {
    query['InstanceIdList'] = request.instanceIdList;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeInstanceSpecs',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the specifications of a specific Anti-DDoS Origin instance.
 *
 * @param request DescribeInstanceSpecsRequest
 * @return DescribeInstanceSpecsResponse
 */
async function describeInstanceSpecs(request: DescribeInstanceSpecsRequest): DescribeInstanceSpecsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeInstanceSpecsWithOptions(request, runtime);
}

model DescribeOnDemandDdosEventRequest {
  endTime?: int32(name='EndTime', description='The end time of the DDoS attack events to query. This value is a UNIX timestamp. Unit: seconds.

This parameter is required.', example='1557909844'),
  instanceId?: string(name='InstanceId', description='The ID of the anti-DDoS diversion instance to query.

>  You can call the [DescribeOnDemandInstance](https://help.aliyun.com/document_detail/152120.html) operation to query the IDs of all anti-DDoS diversion instances.

This parameter is required.', example='ddosbgp-cn-n6w1r7nz****'),
  ip?: string(name='Ip', description='The IP address of the anti-DDoS diversion instance to query.', example='192.XX.XX.1'),
  pageNo?: int32(name='PageNo', description='The page number.

This parameter is required.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Maximum value: **50**.

This parameter is required.', example='10'),
  regionId?: string(name='RegionId', description='The region ID of the anti-DDoS diversion instance to query.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/118703.html) operation to query the most recent region list.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the Anti-DDoS Origin instance belongs in Resource Management.

If you do not specify this parameter, the instance belongs to the default resource group.', example='rg-acfm2pz25js****'),
  startTime?: int32(name='StartTime', description='The start time of the DDoS attack events to query. This value is a UNIX timestamp. Unit: seconds.

This parameter is required.', example='1557305044'),
}

model DescribeOnDemandDdosEventResponseBody = {
  events?: [ 
    {
      endTime?: int32(name='EndTime', description='The time when the DDoS attack stopped. This value is a UNIX timestamp. Unit: seconds.', example='1557891306'),
      ip?: string(name='Ip', description='The attacked IP address.', example='192.XX.XX.1'),
      mbps?: int32(name='Mbps', description='The attack traffic. Unit: Mbit/s.', example='110000'),
      pps?: int32(name='Pps', description='The packet forwarding rate of the DDoS attack. Unit: packets per second (PPS).', example='0'),
      startTime?: int32(name='StartTime', description='The time when the DDoS attack started. This value is a UNIX timestamp. Unit: seconds.', example='1557889506'),
      status?: string(name='Status', description='The status of the DDoS attack event. Valid values:

*   **hole_begin**: indicates that blackhole filtering is triggered.
*   **hole_end**: indicates that tblackhole filtering is deactivated.
*   **defense_begin**: indicates that traffic scrubbing is in progress.
*   **defense_end**: indicates that traffic scrubbing is complete.', example='defense_end'),
    }
  ](name='Events', description='The details about the DDoS attack event.'),
  requestId?: string(name='RequestId', description='The request ID.', example='6A507DC8-F657-4C13-84E2-D1D1B9400753'),
  total?: long(name='Total', description='The total number of DDoS attack events that are returned.', example='1'),
}

model DescribeOnDemandDdosEventResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeOnDemandDdosEventResponseBody(name='body'),
}

/**
 * @summary Queries the DDoS attack events recorded for the IP address of an anti-DDoS diversion instance of Anti-DDoS Origin.
 *
 * @description You can use this operation to query the details about the DDoS attack events that occurred on the IP address of an anti-DDoS diversion instance of Anti-DDoS Origin by page. The details include the start time, end time, volume of attack traffic, and status of each event.
 * ### [](#qps-)Limits
 * You can call this operation up to 10 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeOnDemandDdosEventRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeOnDemandDdosEventResponse
 */
async function describeOnDemandDdosEventWithOptions(request: DescribeOnDemandDdosEventRequest, runtime: Util.RuntimeOptions): DescribeOnDemandDdosEventResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.ip)) {
    query['Ip'] = request.ip;
  }
  if (!Util.isUnset(request.pageNo)) {
    query['PageNo'] = request.pageNo;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeOnDemandDdosEvent',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the DDoS attack events recorded for the IP address of an anti-DDoS diversion instance of Anti-DDoS Origin.
 *
 * @description You can use this operation to query the details about the DDoS attack events that occurred on the IP address of an anti-DDoS diversion instance of Anti-DDoS Origin by page. The details include the start time, end time, volume of attack traffic, and status of each event.
 * ### [](#qps-)Limits
 * You can call this operation up to 10 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeOnDemandDdosEventRequest
 * @return DescribeOnDemandDdosEventResponse
 */
async function describeOnDemandDdosEvent(request: DescribeOnDemandDdosEventRequest): DescribeOnDemandDdosEventResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeOnDemandDdosEventWithOptions(request, runtime);
}

model DescribeOnDemandInstanceStatusRequest {
  instanceIdList?: [ string ](name='InstanceIdList', description='The IDs of the anti-DDoS diversion instances.

>  You can call the [DescribeOnDemandInstance](https://help.aliyun.com/document_detail/152120.html) operation to query the IDs of all anti-DDoS diversion instances.

This parameter is required.', example='ddosbgp-cn-z2q1qzxb****'),
  regionId?: string(name='RegionId', description='The region ID of the anti-DDoS diversion instance.

> You can call the [DescribeRegions](https://help.aliyun.com/document_detail/118703.html) operation to query all regions that are supported by Anti-DDoS Origin.', example='cn-zhangjiakou'),
}

model DescribeOnDemandInstanceStatusResponseBody = {
  instances?: [ 
    {
      declared?: string(name='Declared', description='The details of route advertisement for data centers outside the Chinese mainland. This parameter is a JSON string. The following fields are included in the value:

*   **region**: The code of the data center outside the Chinese mainland. The value is of the string type. For more information, see **Codes of data centers outside the Chinese mainland**.
*   **declared**: indicates whether the data center advertised the route. The value is of the string type. Valid values: **0** and **1**. The value of 0 indicates that the data center did not advertise the route. The value of 1 indicates that the data center advertised the route.', example='[{\\\\"region\\\\":\\\\"oe24\\\\",\\\\"declared\\\\":0},{\\\\"region\\\\":\\\\"oe26\\\\",\\\\"declared\\\\":0},{\\\\"region\\\\":\\\\"oe28\\\\",\\\\"declared\\\\":0},{\\\\"region\\\\":\\\\"oi39\\\\",\\\\"declared\\\\":0},{\\\\"region\\\\":\\\\"us50\\\\",\\\\"declared\\\\":0},{\\\\"region\\\\":\\\\"jp141\\\\",\\\\"declared\\\\":0}]'),
      desc?: string(name='Desc', description='The description of the anti-DDoS diversion instance.

> This parameter is returned only when the information about multiple anti-DDoS diversion instances are returned. The value of this parameter is not returned because the information about only one anti-DDoS diversion instance is returned.', example='test'),
      instanceId?: string(name='InstanceId', description='The ID of the anti-DDoS diversion instance.

> This parameter is returned only when the information about multiple anti-DDoS diversion instances are returned. The value of this parameter is not returned because the information about only one anti-DDoS diversion instance is returned.', example='ddosbgp-cn-z2q1qzxb****'),
      mode?: string(name='Mode', description='The mode that is used to enable traffic rerouting to the anti-DDoS diversion instance. Valid values:

*   **manual**: The instance is manually started.
*   **netflow-auto**: The instance is automatically started by using NetFlow that monitors network traffic.', example='netflow-auto'),
      net?: string(name='Net', description='The CIDR block of the anti-DDoS diversion instance.', example='47.***.***.0/24'),
      registedAs?: string(name='RegistedAs', description='The number of the autonomous system (AS). Set the value to **0**, which indicates that AS is disabled.', example='0'),
      userId?: string(name='UserId', description='The ID of the Alibaba Cloud account.', example='171986973287****'),
    }
  ](name='Instances', description='The details of the anti-DDoS diversion instance.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='CC49FF51-612F-429B-AB1E-374B3F115396'),
}

model DescribeOnDemandInstanceStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeOnDemandInstanceStatusResponseBody(name='body'),
}

/**
 * @summary Queries the details of anti-DDoS diversion instances.
 *
 * @param request DescribeOnDemandInstanceStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeOnDemandInstanceStatusResponse
 */
async function describeOnDemandInstanceStatusWithOptions(request: DescribeOnDemandInstanceStatusRequest, runtime: Util.RuntimeOptions): DescribeOnDemandInstanceStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceIdList)) {
    query['InstanceIdList'] = request.instanceIdList;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeOnDemandInstanceStatus',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the details of anti-DDoS diversion instances.
 *
 * @param request DescribeOnDemandInstanceStatusRequest
 * @return DescribeOnDemandInstanceStatusResponse
 */
async function describeOnDemandInstanceStatus(request: DescribeOnDemandInstanceStatusRequest): DescribeOnDemandInstanceStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeOnDemandInstanceStatusWithOptions(request, runtime);
}

model DescribeOpEntitiesRequest {
  currentPage?: int32(name='CurrentPage', description='The page number.

This parameter is required.', example='1'),
  endTime?: long(name='EndTime', description='The end time. Operation logs that were generated before this time are queried.**** The value is a UNIX timestamp. Unit: milliseconds.

This parameter is required.', example='1640880000000'),
  instanceId?: string(name='InstanceId', description='The ID of the instance to query.

> You can call the [DescribeInstanceList](https://help.aliyun.com/document_detail/118698.html) operation to query the IDs of all instances.', example='ddosbgp-cn-n6w1r7nz****'),
  opAction?: int32(name='OpAction', description='The type of the operation. Valid values:

*   **3**: Add an IP address to the instance.
*   **4**: Remove an IP address from the instance.
*   **5**: Downgrade the instance.
*   **6**: Deactivate blackhole filtering.
*   **7**: Reset the number of times that you can deactivate blackhole filtering.
*   **8**: Restore the mitigation capability.
*   **9**: Add an asset group.
*   **10**: Remove an asset group.
*   **11**: Enable the metering method of daily 95th percentile for the burstable clean bandwidth feature.
*   **12**: Enable the metering method of monthly 95th percentile for the burstable clean bandwidth feature.
*   **13**: Periodically switch between the metering methods of daily 95th percentile and monthly 95th percentile for the burstable clean bandwidth feature.
*   **14**: Disable the metering method of daily 95th percentile for the burstable clean bandwidth feature.
*   **15**: Disable the metering method of monthly 95th percentile for the burstable clean bandwidth feature.
*   **16**: Disable burstable clean bandwidth due to overdue payments.
*   **17**: Disable burstable clean bandwidth due to instance expiration.', example='3'),
  orderBy?: string(name='OrderBy', description='The sorting method of operation logs. Set the value to **opdate**, which indicates sorting based on the operation time.', example='opdate'),
  orderDir?: string(name='OrderDir', description='The sort order of operation logs. Valid values:

*   **ASC**: the ascending order.
*   **DESC**: the descending order.

Default value: **DESC**.', example='ASC'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Maximum value: 50.

This parameter is required.', example='10'),
  regionId?: string(name='RegionId', description='The ID of the region where the instance resides.

> You can call the [DescribeRegions](https://help.aliyun.com/document_detail/118703.html) operation to query the most recent region list.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the instance belongs in Resource Management.

If you do not specify this parameter, the instance belongs to the default resource group.', example='rg-acfm2pz25js****'),
  startTime?: long(name='StartTime', description='The start time. Operation logs that were generated after this time are queried.**** The value is a UNIX timestamp. Unit: milliseconds.

This parameter is required.', example='1609430400000'),
}

model DescribeOpEntitiesResponseBody = {
  opEntities?: [ 
    {
      entityObject?: string(name='EntityObject', description='The operation object, which is the ID of the instance.', example='ddosbgp-cn-n6w1r7nz****'),
      entityType?: int32(name='EntityType', description='The type of the operation object. The value is fixed as **1**, which indicates Anti-DDoS Origin instances.', example='1'),
      gmtCreate?: long(name='GmtCreate', description='The time when the log was generated. The value is a UNIX timestamp. Unit: milliseconds.', example='1635818114000'),
      opAccount?: string(name='OpAccount', description='The ID of the Alibaba Cloud account that performs the operation.

> If the value is **system**, the operation is performed by Anti-DDoS Origin.', example='171986973287****'),
      opAction?: int32(name='OpAction', description='The type of operation. Valid values:

*   **3**: indicates an operation to add an IP address to the Anti-DDoS Origin instance for protection.
*   **4**: indicates an operation to remove a protected IP address from the Anti-DDoS Origin instance.
*   **5**: indicates an operation to downgrade the Anti-DDoS Origin instance.
*   **6**: indicates an operation to deactivate blackhole filtering for an IP address.
*   **7**: indicates an operation to reset the number of times that you can deactivate blackhole filtering.
*   **8**: indicates an operation to enable burstable protection.', example='8'),
      opDesc?: string(name='OpDesc', description='The details of the operation. The value is a string that consists of a JSON struct. The JSON struct contains the following fields:

*   **entity**: the operation object. Data type: object. The fields that are included in the value of the **entity** parameter vary based on the value of the **OpAction** parameter. Valid values:

    *   If the value of the **OpAction** parameter is **3**, the value of the **entity** parameter consists of the following field:

        *   **ips**: the public IP addresses that are protected by the Anti-DDoS Origin instance. Data type: array

    *   If the value of the **OpAction** parameter is **4**, the value of the **entity** parameter consists of the following field:

        *   **ips**: the public IP addresses that are no longer protected by the Anti-DDoS Origin instance. Data type: array.

    *   If the value of the **OpAction** parameter is **5**, the value of the **entity** parameter consists of the following fields:

        *   **baseBandwidth**: the basic protection bandwidth. Unit: Gbit/s. Data type: integer.
        *   **elasticBandwidth**: the burstable protection bandwidth. Unit: Gbit/s. Data type: integer.
        *   **opSource**: the source of the operation. The value is fixed as **1**, indicating that the operation is performed by Anti-DDoS Origin. Data type: integer.

    *   If the value of the **OpAction** parameter is **6**, the value of the **entity** parameter consists of the following field:

        *   **ips**: the public IP addresses for which to deactivate blackhole filtering. Data type: array.

    *   If the value of the **OpAction** parameter is **7**, the **entity** parameter is not returned.

    *   If the value of the **OpAction** parameter is **8**, the value of the **entity** parameter consists of the following fields:

        *   **baseBandwidth**: the basic protection bandwidth. Unit: Gbit/s. Data type: integer.
        *   **elasticBandwidth**: the burstable protection bandwidth. Unit: Gbit/s. Data type: integer.', example='{"entity":{"baseBandwidth":20,"elasticBandwidth":20}}'),
    }
  ](name='OpEntities', description='The details of the operation log.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='52C8ECB0-0B1A-4E66-A31C-B6A855120E82'),
  totalCount?: int32(name='TotalCount', description='The total number of operation logs.', example='1'),
}

model DescribeOpEntitiesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeOpEntitiesResponseBody(name='body'),
}

/**
 * @summary Queries the operation logs of an Anti-DDoS Origin instance.
 *
 * @description You can call the DescribeOpEntities operation to query the operation logs of an instance by page.
 * ### Limit
 * You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeOpEntitiesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeOpEntitiesResponse
 */
async function describeOpEntitiesWithOptions(request: DescribeOpEntitiesRequest, runtime: Util.RuntimeOptions): DescribeOpEntitiesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.currentPage)) {
    query['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.opAction)) {
    query['OpAction'] = request.opAction;
  }
  if (!Util.isUnset(request.orderBy)) {
    query['OrderBy'] = request.orderBy;
  }
  if (!Util.isUnset(request.orderDir)) {
    query['OrderDir'] = request.orderDir;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeOpEntities',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the operation logs of an Anti-DDoS Origin instance.
 *
 * @description You can call the DescribeOpEntities operation to query the operation logs of an instance by page.
 * ### Limit
 * You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeOpEntitiesRequest
 * @return DescribeOpEntitiesResponse
 */
async function describeOpEntities(request: DescribeOpEntitiesRequest): DescribeOpEntitiesResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeOpEntitiesWithOptions(request, runtime);
}

model DescribePackIpListRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Anti-DDoS Origin instance to query.

>  You can call the [DescribeInstanceList](https://help.aliyun.com/document_detail/118698.html) operation to query the IDs of all Anti-DDoS Origin instances.

This parameter is required.', example='ddosbgp-cn-n6w1r7nz****'),
  ip?: string(name='Ip', description='The protected IP address to query.', example='47.98.XX.XX'),
  memberUid?: string(name='MemberUid', description='The ID of the member.', example='170858869679****'),
  pageNo?: int32(name='PageNo', description='The number of the page to return.

This parameter is required.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries to return on each page.

This parameter is required.', example='10'),
  productName?: string(name='ProductName', description='The type of the cloud asset to which the protected IP address to query belongs. Valid values:

*   **ECS**: an Elastic Compute Service (ECS) instance.
*   **SLB**: a Classic Load Balancer (CLB) instance, originally called a Server Load Balancer (SLB) instance.
*   **EIP**: an elastic IP address (EIP). An Internet-facing Application Load Balancer (ALB) instance uses an EIP. If the IP address belongs to the Internet-facing ALB instance, set this parameter to EIP.
*   **WAF**: a Web Application Firewall (WAF) instance.', example='ECS'),
  regionId?: string(name='RegionId', description='The ID of the region where the Anti-DDoS Origin instance resides.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/118703.html) operation to query the most recent region list.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the Anti-DDoS Origin instance belongs in Resource Management.

If you do not specify this parameter, the instance belongs to the default resource group.', example='rg-acfm2pz25js****'),
}

model DescribePackIpListResponseBody = {
  code?: string(name='Code', description='The HTTP status code of the request.

For more information about status codes, see [Common parameters](https://help.aliyun.com/document_detail/118841.html).', example='200'),
  ipList?: [ 
    {
      ip?: string(name='Ip', description='The IP address.', example='47.98.XX.XX'),
      memberUid?: string(name='MemberUid', description='The ID of the member.', example='170858869679****'),
      nsmExpireAt?: long(name='NsmExpireAt', description='The time when the near-origin traffic diversion feature was disabled.', example='1715658000'),
      nsmStartAt?: long(name='NsmStartAt', description='The time when the near-origin traffic diversion feature was enabled.', example='1715655000'),
      nsmStatus?: int32(name='NsmStatus', description='The status of the near-origin traffic diversion feature. Valid values:

*   **1**: The near-origin traffic diversion feature is enabled.
*   **0**: The near-origin traffic diversion feature is disabled.', example='0'),
      product?: string(name='Product', description='The type of the cloud asset to which the IP address belongs. Valid values:

*   **ECS**: an ECS instance.
*   **SLB**: a CLB (formerly SLB) instance.
*   **EIP**: an EIP. If the IP address belongs to an ALB instance, the value EIP is returned.
*   **WAF**: a WAF instance.', example='ECS'),
      region?: string(name='Region', description='The region to which the protected IP address belongs.

>  If the protected IP address is in the same region as the instance, this parameter is not returned.', example='cn-hangzhou'),
      remark?: string(name='Remark', description='The description of the cloud asset to which the IP address belongs. The asset can be an ECS instance or an SLB instance.

>  If no descriptions are provided for the asset, this parameter is not returned.', example='test'),
      status?: string(name='Status', description='The status of the IP address. Valid values:

*   **normal**: The IP address is not under attack.
*   **hole_begin**: Blackhole filtering is triggered for the IP address.', example='normal'),
    }
  ](name='IpList', description='The IP addresses that are protected by the instance.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='4FD1578A-BD77-50B7-A969-45A374A7ED22'),
  success?: boolean(name='Success', description='Indicates whether the request is successful. Valid values:

*   **true**: The call is successful.
*   **false**: The call fails.', example='true'),
  total?: int32(name='Total', description='The number of protected IP addresses.', example='1'),
}

model DescribePackIpListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribePackIpListResponseBody(name='body'),
}

/**
 * @summary Queries the IP addresses that are protected by a specific Anti-DDoS Origin instance.
 *
 * @description You can call the DescribePackIpList operation to query the details about each IP address that is protected by a specific Anti-DDoS Origin instance by page. The details include the IP address and the type of the cloud asset to which the IP address belongs. The details also include the status of the IP address, such as whether blackhole filtering is triggered for the IP address.  
 * ## Limits
 * You can call this operation up to 10 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribePackIpListRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribePackIpListResponse
 */
async function describePackIpListWithOptions(request: DescribePackIpListRequest, runtime: Util.RuntimeOptions): DescribePackIpListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.ip)) {
    query['Ip'] = request.ip;
  }
  if (!Util.isUnset(request.memberUid)) {
    query['MemberUid'] = request.memberUid;
  }
  if (!Util.isUnset(request.pageNo)) {
    query['PageNo'] = request.pageNo;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.productName)) {
    query['ProductName'] = request.productName;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribePackIpList',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the IP addresses that are protected by a specific Anti-DDoS Origin instance.
 *
 * @description You can call the DescribePackIpList operation to query the details about each IP address that is protected by a specific Anti-DDoS Origin instance by page. The details include the IP address and the type of the cloud asset to which the IP address belongs. The details also include the status of the IP address, such as whether blackhole filtering is triggered for the IP address.  
 * ## Limits
 * You can call this operation up to 10 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribePackIpListRequest
 * @return DescribePackIpListResponse
 */
async function describePackIpList(request: DescribePackIpListRequest): DescribePackIpListResponse {
  var runtime = new Util.RuntimeOptions{};
  return describePackIpListWithOptions(request, runtime);
}

model DescribeRdMemberListRequest {
  pageNo?: int32(name='PageNo', description='The page number.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Default value: **10**.', example='10'),
  resourceDirectoryId?: string(name='ResourceDirectoryId', description='The ID of the resource directory.', example='rd-x9bLhd'),
}

model DescribeRdMemberListResponseBody = {
  memberList?: [ 
    {
      gmtCreate?: long(name='GmtCreate', description='The creation time.', example='1624954942000'),
      name?: string(name='Name', description='The name of the member.', example='test1'),
      uid?: string(name='Uid', description='The Alibaba Cloud account ID of the member.', example='1960279802016267'),
    }
  ](name='MemberList', description='The list of the members.'),
  requestId?: string(name='RequestId', description='The request ID.', example='DC245DEE-9800-5579-BF99-189D6A5BA9FE'),
  total?: long(name='Total', description='The total number of entries returned.', example='10'),
}

model DescribeRdMemberListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeRdMemberListResponseBody(name='body'),
}

/**
 * @summary Queries members that are managed by using the multi-account management feature.
 *
 * @param request DescribeRdMemberListRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeRdMemberListResponse
 */
async function describeRdMemberListWithOptions(request: DescribeRdMemberListRequest, runtime: Util.RuntimeOptions): DescribeRdMemberListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.pageNo)) {
    query['PageNo'] = request.pageNo;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.resourceDirectoryId)) {
    query['ResourceDirectoryId'] = request.resourceDirectoryId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeRdMemberList',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries members that are managed by using the multi-account management feature.
 *
 * @param request DescribeRdMemberListRequest
 * @return DescribeRdMemberListResponse
 */
async function describeRdMemberList(request: DescribeRdMemberListRequest): DescribeRdMemberListResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeRdMemberListWithOptions(request, runtime);
}

model DescribeRdStatusResponseBody = {
  currentUid?: string(name='CurrentUid', description='The Alibaba Cloud account ID of the current account.', example='125085778340****'),
  currentUidType?: string(name='CurrentUidType', description='The type of the Alibaba Cloud account. Valid values:

*   **MasterAccount**: management account.
*   **DelegatedAdminAccount**: delegated administrator account.
*   **MemberAccount**: member.', example='MemberAccount'),
  enabled?: boolean(name='Enabled', description='Indicates whether the multi-account management feature is enabled for Anti-DDoS Origin.', example='false'),
  localEnable?: boolean(name='LocalEnable', description='Indicates whether the multi-account management feature is enabled for the current account in Anti-DDoS Origin.', example='false'),
  masterUid?: string(name='MasterUid', description='The Alibaba Cloud account ID of the management account in the resource directory.', example='125085778340****'),
  remoteEnable?: boolean(name='RemoteEnable', description='Indicates whether Resource Directory is enabled in the [Resource Management console](https://resourcemanager.console.aliyun.com).', example='false'),
  requestId?: string(name='RequestId', description='The request ID.', example='1B0F7EC6-51D7-4D70-B0EC-CD8A9E998D86'),
  rootUid?: string(name='RootUid', description='The Alibaba Cloud account ID of the management account for which the multi-account management feature is enabled in Anti-DDoS Origin.', example='125085778340****'),
  servicePrincipalEnabled?: boolean(name='ServicePrincipalEnabled', description='Indicates whether the trusted service is enabled.', example='false'),
}

model DescribeRdStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeRdStatusResponseBody(name='body'),
}

/**
 * @summary Queries the status of the multi-account management feature.
 *
 * @param request DescribeRdStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeRdStatusResponse
 */
async function describeRdStatusWithOptions(runtime: Util.RuntimeOptions): DescribeRdStatusResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'DescribeRdStatus',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the status of the multi-account management feature.
 *
 * @return DescribeRdStatusResponse
 */
async function describeRdStatus(): DescribeRdStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeRdStatusWithOptions(runtime);
}

model DescribeRegionsRequest {
  regionId?: string(name='RegionId', description='The ID of the region. The default value is **cn-hangzhou**. If the default value is used, the regions of cloud assets that can be protected by Anti-DDoS Origin in the China (Hangzhou) region are queried.

If you want to specify another value for **RegionId**, see [Regions and Zones](https://help.aliyun.com/document_detail/40654.html).', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the Anti-DDoS Origin instance belongs in Resource Management. This parameter is empty by default, which indicates that the Anti-DDoS Origin instance belongs to the default resource group.

For information about resource groups, see [Create a resource group](https://help.aliyun.com/document_detail/94485.html).', example='rg-acfm2pz25js****'),
}

model DescribeRegionsResponseBody = {
  code?: string(name='Code', description='The HTTP status code.', example='200'),
  regions?: [ 
    {
      regionEnName?: string(name='RegionEnName', description='The English name of the region.', example='China (Hangzhou)'),
      regionId?: string(name='RegionId', description='The ID of the region.', example='cn-hangzhou'),
      regionName?: string(name='RegionName', description='The Chinese name of the region.', example='华东1（杭州）'),
    }
  ](name='Regions', description='The information about the regions of cloud assets that can be protected by Anti-DDoS Origin. The information includes region IDs and names.'),
  requestId?: string(name='RequestId', description='The request ID.', example='F7CA8B4E-FB15-4336-A351-8DC29D66EA82'),
  success?: boolean(name='Success', description='Indicates whether the request was successful. Valid values:

*   **true**
*   **false**', example='true'),
}

model DescribeRegionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeRegionsResponseBody(name='body'),
}

/**
 * @summary Queries the regions of assets that can be protected by Anti-DDoS Origin Enterprise in a specific region.
 *
 * @param request DescribeRegionsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeRegionsResponse
 */
async function describeRegionsWithOptions(request: DescribeRegionsRequest, runtime: Util.RuntimeOptions): DescribeRegionsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeRegions',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the regions of assets that can be protected by Anti-DDoS Origin Enterprise in a specific region.
 *
 * @param request DescribeRegionsRequest
 * @return DescribeRegionsResponse
 */
async function describeRegions(request: DescribeRegionsRequest): DescribeRegionsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeRegionsWithOptions(request, runtime);
}

model DescribeTrafficRequest {
  endTime?: int32(name='EndTime', description='The end of the time range to query. The value is a UNIX timestamp. Unit: seconds.

If you do not specify this parameter, the current system time is used as the end time.', example='1563445054'),
  flowType?: string(name='FlowType', description='The type of the traffic statistics to query. Valid values:

*   **max**: the peak traffic within the specified interval.
*   **avg**: the average traffic within the specified interval.

Enumerated values:

*   all
*   avg
*   max', example='max'),
  instanceId?: string(name='InstanceId', description='The ID of the Anti-DDoS Origin instance to query.

>  You can call the [DescribeInstanceList](https://help.aliyun.com/document_detail/118698.html) operation to query the IDs of all Anti-DDoS Origin instances.

If you specify an on-demand instance, you must configure the **Interval** parameter.', example='ddosbgp-cn-n6w203qg****'),
  interval?: int32(name='Interval', description='The interval at which the traffic statistics are calculated. Unit: seconds. Default value: **5**.', example='5'),
  ip?: string(name='Ip', description='The public IP address of the asset to query. If you do not specify this parameter, the traffic statistics of all public IP addresses that are protected by the Anti-DDoS Origin instance are queried.

>  The public IP address must be a protected object of the Anti-DDoS Origin instance. You can call the [DescribePackIpList](https://help.aliyun.com/document_detail/118701.html) operation to query all protected objects of the Anti-DDoS Origin instance.', example='39.XX.XX.96'),
  ipnet?: string(name='Ipnet', description='The Classless Inter-Domain Routing (CIDR) block of the on-demand instance that you want to query.', example='111.XX.XX.0/24'),
  regionId?: string(name='RegionId', description='The ID of the region where the Anti-DDoS Origin instance resides.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/118703.html) operation to query the most recent region list.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the Anti-DDoS Origin instance belongs in Resource Management.

If you do not specify this parameter, the instance belongs to the default resource group.', example='rg-acfm2pz25js****'),
  startTime?: int32(name='StartTime', description='The beginning of the time range to query. The value is a UNIX timestamp. Unit: seconds.

This parameter is required.', example='1619798400'),
}

model DescribeTrafficResponseBody = {
  flowList?: [ 
    {
      attackBps?: long(name='AttackBps', description='The bandwidth of attack traffic. Unit: bit/s.

>  This parameter is returned only if attack traffic exists.', example='0'),
      attackPps?: long(name='AttackPps', description='The packet forwarding rate of attack traffic. Unit: packets per second.

>  This parameter is returned only if attack traffic exists.', example='0'),
      flowType?: string(name='FlowType', description='The type of the traffic statistics. Valid values:

*   **max**: the peak traffic within the specified interval
*   **avg**: the average traffic within the specified interval', example='max'),
      kbps?: int32(name='Kbps', description='The bandwidth of the total traffic. Unit: Kbit/s.', example='417'),
      name?: string(name='Name', description='The ID of the traffic statistics.', example='8e33f19e-5644-11eb-b5c1-d89d67182200'),
      pps?: int32(name='Pps', description='The packet forwarding rate of the total traffic. Unit: packets per second.', example='274'),
      time?: int32(name='Time', description='The time when the traffic statistics are calculated. This value is a UNIX timestamp. Unit: seconds.', example='1620951900'),
    }
  ](name='FlowList', description='The queried traffic statistics.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='6A507DC8-F657-4C13-84E2-D1D1B9400753'),
}

model DescribeTrafficResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeTrafficResponseBody(name='body'),
}

/**
 * @summary Queries traffic statistics of an Anti-DDoS Origin instance within a specific time period.
 *
 * @description You can call the DescribeTraffic operation to query traffic statistics of an Anti-DDoS Origin instance within a specific time period.  
 * >  When you call this operation, you must configure the **InstanceId** parameter to specify the Anti-DDoS Origin instance whose traffic statistics you want to query.  
 * ## Limits
 * You can call this operation once per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeTrafficRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeTrafficResponse
 */
async function describeTrafficWithOptions(request: DescribeTrafficRequest, runtime: Util.RuntimeOptions): DescribeTrafficResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.flowType)) {
    query['FlowType'] = request.flowType;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.interval)) {
    query['Interval'] = request.interval;
  }
  if (!Util.isUnset(request.ip)) {
    query['Ip'] = request.ip;
  }
  if (!Util.isUnset(request.ipnet)) {
    query['Ipnet'] = request.ipnet;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeTraffic',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries traffic statistics of an Anti-DDoS Origin instance within a specific time period.
 *
 * @description You can call the DescribeTraffic operation to query traffic statistics of an Anti-DDoS Origin instance within a specific time period.  
 * >  When you call this operation, you must configure the **InstanceId** parameter to specify the Anti-DDoS Origin instance whose traffic statistics you want to query.  
 * ## Limits
 * You can call this operation once per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeTrafficRequest
 * @return DescribeTrafficResponse
 */
async function describeTraffic(request: DescribeTrafficRequest): DescribeTrafficResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeTrafficWithOptions(request, runtime);
}

model DetachFromPolicyRequest {
  ipPortProtocolList?: [ 
    {
      ip?: string(name='Ip', description='The IP address of the protected object.

This parameter is required.', example='47.118.172.***'),
      port?: int32(name='Port', description='The port of the protected object.', example='8*'),
      protocol?: string(name='Protocol', description='The protocol type of the protected object. Valid values:

*   **tcp**
*   **udp**', example='tcp'),
    }
  ](name='IpPortProtocolList', description='The protected objects.

This parameter is required.'),
  policyType?: string(name='PolicyType', description='The type of the policy. Valid values:

*   **default**: the default mitigation policies.
*   **l3**: IP-specific mitigation policies.
*   **l4**: port-specific mitigation policies.

This parameter is required.', example='l3'),
}

model DetachFromPolicyShrinkRequest {
  ipPortProtocolListShrink?: string(name='IpPortProtocolList', description='The protected objects.

This parameter is required.'),
  policyType?: string(name='PolicyType', description='The type of the policy. Valid values:

*   **default**: the default mitigation policies.
*   **l3**: IP-specific mitigation policies.
*   **l4**: port-specific mitigation policies.

This parameter is required.', example='l3'),
}

model DetachFromPolicyResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='1B0F7EC6-51D7-4D70-B0EC-CD8A9E99****'),
}

model DetachFromPolicyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DetachFromPolicyResponseBody(name='body'),
}

/**
 * @summary Removes protected objects from a mitigation policy.
 *
 * @param tmpReq DetachFromPolicyRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DetachFromPolicyResponse
 */
async function detachFromPolicyWithOptions(tmpReq: DetachFromPolicyRequest, runtime: Util.RuntimeOptions): DetachFromPolicyResponse {
  Util.validateModel(tmpReq);
  var request = new DetachFromPolicyShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.ipPortProtocolList)) {
    request.ipPortProtocolListShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.ipPortProtocolList, 'IpPortProtocolList', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.ipPortProtocolListShrink)) {
    query['IpPortProtocolList'] = request.ipPortProtocolListShrink;
  }
  if (!Util.isUnset(request.policyType)) {
    query['PolicyType'] = request.policyType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DetachFromPolicy',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Removes protected objects from a mitigation policy.
 *
 * @param request DetachFromPolicyRequest
 * @return DetachFromPolicyResponse
 */
async function detachFromPolicy(request: DetachFromPolicyRequest): DetachFromPolicyResponse {
  var runtime = new Util.RuntimeOptions{};
  return detachFromPolicyWithOptions(request, runtime);
}

model DettachAssetGroupToInstanceRequest {
  assetGroupList?: [ 
    {
      name?: string(name='Name', description='The ID of the asset. If the asset is a Web Application Firewall (WAF) instance, specify the ID of the WAF instance.

This parameter is required.', example='waf_v2_public_cn-lbj382l****'),
      region?: string(name='Region', description='The region ID of the asset.

This parameter is required.', example='cn-hangzhou'),
      type?: string(name='Type', description='The type of the asset. Valid values:

*   **waf**: WAF instance
*   **ga**: Global Accelerator (GA) instance

This parameter is required.', example='waf'),
    }
  ](name='AssetGroupList', description='The information about the asset that you want to dissociate.

This parameter is required.'),
  instanceId?: string(name='InstanceId', description='The ID of the instance.

>  You can call the [DescribeInstanceList](https://help.aliyun.com/document_detail/118698.html) operation to query the IDs of all Anti-DDoS Origin instances of paid editions.

This parameter is required.', example='ddosbgp-xxx'),
  regionId?: string(name='RegionId', description='The ID of the region in which the instance resides.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/118703.html) operation to query the most recent region list.', example='cn-hangzhou'),
}

model DettachAssetGroupToInstanceShrinkRequest {
  assetGroupListShrink?: string(name='AssetGroupList', description='The information about the asset that you want to dissociate.

This parameter is required.'),
  instanceId?: string(name='InstanceId', description='The ID of the instance.

>  You can call the [DescribeInstanceList](https://help.aliyun.com/document_detail/118698.html) operation to query the IDs of all Anti-DDoS Origin instances of paid editions.

This parameter is required.', example='ddosbgp-xxx'),
  regionId?: string(name='RegionId', description='The ID of the region in which the instance resides.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/118703.html) operation to query the most recent region list.', example='cn-hangzhou'),
}

model DettachAssetGroupToInstanceResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='E54BA258-9DE8-59BE-B7A8-DAD28E6E8DAF'),
}

model DettachAssetGroupToInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DettachAssetGroupToInstanceResponseBody(name='body'),
}

/**
 * @summary Dissociates an asset from an Anti-DDoS Origin instance of a paid edition.
 *
 * @param tmpReq DettachAssetGroupToInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DettachAssetGroupToInstanceResponse
 */
async function dettachAssetGroupToInstanceWithOptions(tmpReq: DettachAssetGroupToInstanceRequest, runtime: Util.RuntimeOptions): DettachAssetGroupToInstanceResponse {
  Util.validateModel(tmpReq);
  var request = new DettachAssetGroupToInstanceShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.assetGroupList)) {
    request.assetGroupListShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.assetGroupList, 'AssetGroupList', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.assetGroupListShrink)) {
    query['AssetGroupList'] = request.assetGroupListShrink;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DettachAssetGroupToInstance',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Dissociates an asset from an Anti-DDoS Origin instance of a paid edition.
 *
 * @param request DettachAssetGroupToInstanceRequest
 * @return DettachAssetGroupToInstanceResponse
 */
async function dettachAssetGroupToInstance(request: DettachAssetGroupToInstanceRequest): DettachAssetGroupToInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return dettachAssetGroupToInstanceWithOptions(request, runtime);
}

model GetSlsOpenStatusRequest {
  regionId?: string(name='RegionId', description='The ID of the region where the Anti-DDoS Origin instance resides.

For more information about the valid values of this parameter, see [Regions and zones](https://help.aliyun.com/document_detail/188196.html).', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the Anti-DDoS Origin instance belongs in Resource Management. This parameter is empty by default, which indicates that the instance belongs to the default resource group.

For more information about resource groups, see [Create a resource group](https://help.aliyun.com/document_detail/94485.html).', example='rg-acfm2pz25js****'),
}

model GetSlsOpenStatusResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='D01666F5-541B-4C78-98A6-D29E02DAAC7C'),
  slsOpenStatus?: boolean(name='SlsOpenStatus', description='Indicates whether Simple Log Service was activated. Valid values:

*   **true**
*   **false**', example='true'),
}

model GetSlsOpenStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetSlsOpenStatusResponseBody(name='body'),
}

/**
 * @summary Queries whether Simple Log Service is activated.
 *
 * @param request GetSlsOpenStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetSlsOpenStatusResponse
 */
async function getSlsOpenStatusWithOptions(request: GetSlsOpenStatusRequest, runtime: Util.RuntimeOptions): GetSlsOpenStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetSlsOpenStatus',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries whether Simple Log Service is activated.
 *
 * @param request GetSlsOpenStatusRequest
 * @return GetSlsOpenStatusResponse
 */
async function getSlsOpenStatus(request: GetSlsOpenStatusRequest): GetSlsOpenStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return getSlsOpenStatusWithOptions(request, runtime);
}

model ListOpenedAccessLogInstancesRequest {
  pageNumber?: int32(name='PageNumber', description='The page number. Pages start from page 1. Default value: **1**.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Default value: **10**.', example='10'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the Anti-DDoS Origin instance belongs in Resource Management. This parameter is empty by default, which indicates that the instance belongs to the default resource group.

For more information about resource groups, see [Create a resource group](https://help.aliyun.com/document_detail/94485.html).', example='rg-acfm2pz25js****'),
}

model ListOpenedAccessLogInstancesResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='4DB64811-70A1-41C9-A0CE-CD8B260ED551'),
  slsConfigStatus?: [ 
    {
      enable?: boolean(name='Enable', description='Indicates whether log analysis was enabled for the Anti-DDoS Origin instance. Valid values:

*   **true**
*   **false**', example='true'),
      instanceId?: string(name='InstanceId', description='The ID of the Anti-DDoS Origin instance.', example='ddosbgp-cn-m7r1zce2****'),
    }
  ](name='SlsConfigStatus', description='The configuration of log analysis for the Anti-DDoS Origin instance.'),
  totalCount?: int32(name='TotalCount', description='The number of the Anti-DDoS Origin instances for which log analysis was enabled.', example='1'),
}

model ListOpenedAccessLogInstancesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListOpenedAccessLogInstancesResponseBody(name='body'),
}

/**
 * @summary Queries the Anti-DDoS Origin instances for which log analysis is enabled.
 *
 * @param request ListOpenedAccessLogInstancesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListOpenedAccessLogInstancesResponse
 */
async function listOpenedAccessLogInstancesWithOptions(request: ListOpenedAccessLogInstancesRequest, runtime: Util.RuntimeOptions): ListOpenedAccessLogInstancesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListOpenedAccessLogInstances',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the Anti-DDoS Origin instances for which log analysis is enabled.
 *
 * @param request ListOpenedAccessLogInstancesRequest
 * @return ListOpenedAccessLogInstancesResponse
 */
async function listOpenedAccessLogInstances(request: ListOpenedAccessLogInstancesRequest): ListOpenedAccessLogInstancesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listOpenedAccessLogInstancesWithOptions(request, runtime);
}

model ListPolicyRequest {
  name?: string(name='Name', description='The name of the policy.', example='test**'),
  pageNo?: long(name='PageNo', description='The page number.', example='1'),
  pageSize?: long(name='PageSize', description='The number of entries per page. Default value: **10**.', example='10'),
  productType?: string(name='ProductType', description='The service type. Valid values:

*   **ecs**: Elastic Compute Service (ECS).
*   **slb**: Server Load Balancer (SLB).
*   **eip**: Elastic IP Address (EIP).
*   **gf-eip**: EIP with Anti-DDoS (Enhanced) enabled.

>  This parameter is available only if Type is set to `default`.', example='ecs'),
  type?: string(name='Type', description='The type of the policy. Valid values:

*   **default**: the default mitigation policy.
*   **l3**: IP-specific mitigation policies.
*   **l4**: port-specific mitigation policies.', example='l3'),
}

model ListPolicyResponseBody = {
  policyList?: [ 
    {
      attachedCount?: int32(name='AttachedCount', description='The number of protected objects that are added to the policy.', example='0'),
      content?: {
        blackIpListExpireAt?: long(name='BlackIpListExpireAt', description='The validity period of the IP address blacklist. The value is a UNIX timestamp.', example='1716878000'),
        enableDropIcmp?: boolean(name='EnableDropIcmp', description='Indicates whether ICMP blocking is enabled.', example='false'),
        enableIntelligence?: boolean(name='EnableIntelligence', description='Indicates whether intelligent protection is enabled.', example='true'),
        enableL4Defense?: boolean(name='EnableL4Defense', description='Indicates whether port-specific mitigation is enabled.', example='true'),
        fingerPrintRuleList?: [ 
          {
            dstPortEnd?: int32(name='DstPortEnd', description='The end of the destination port range. Valid values: **0** to **65535**.', example='65535'),
            dstPortStart?: int32(name='DstPortStart', description='The start of the destination port range. Valid values: **0** to **65535**.', example='0'),
            id?: string(name='Id', description='The ID of the rule.', example='2c0b09cd-a565-4481-9acb-418b********'),
            matchAction?: string(name='MatchAction', description='The action triggered if the rule is matched. Valid values:

*   **accept**: allows the traffic that matches the conditions in the byte-match filter rule.
*   **drop**: discards the traffic that matches the conditions in the byte-match filter rule.
*   **ip_rate**: limits rates on the source IP address whose traffic matches the conditions in the byte-match filter rule. The rate limit is specified by **RateValue**.
*   **session_rate**: limits the number of sessions from the source IP address whose traffic matches the conditions in the byte-match filter rule. The rate limit is specified by **RateValue**.', example='drop'),
            maxPktLen?: int32(name='MaxPktLen', description='The maximum packet length. Valid values: **1** to **1500**.', example='1500'),
            minPktLen?: int32(name='MinPktLen', description='The minimum packet length. Valid values: **1** to **1500**.', example='1'),
            offset?: int32(name='Offset', description='The offset. Valid values: **0** to **1500**.', example='0'),
            payloadBytes?: string(name='PayloadBytes', description='The payload. The value is a hexadecimal string.', example='abcd'),
            protocol?: string(name='Protocol', description='The protocol type. Valid values:

*   **tcp**
*   **udp**', example='udp'),
            rateValue?: int32(name='RateValue', description='The rate limit. Valid values: **1** to **100000**.

>  This parameter is required when **MatchAction** is set to **ip_rate** or **session_rate**.', example='1000'),
            seqNo?: int32(name='SeqNo', description='The sequence number that indicates the order for the rule to take effect. The value is an integer.', example='1'),
            srcPortEnd?: int32(name='SrcPortEnd', description='The end of the source port range. Valid values: **0** to **65535**.', example='65535'),
            srcPortStart?: int32(name='SrcPortStart', description='The start of the source port range. Valid values: **0** to **65535**.', example='0'),
          }
        ](name='FingerPrintRuleList', description='The byte-match filter rules.'),
        intelligenceLevel?: string(name='IntelligenceLevel', description='The level of intelligent protection. Valid values:

*   **default**: normal.
*   **hard**: strict.
*   **weak**: loose.', example='default'),
        l4RuleList?: [ 
          {
            action?: string(name='Action', description='The action that is specified in the rule. Valid value:

*   **2**: The traffic is discarded.', example='2'),
            conditionList?: [ 
              {
                arg?: string(name='Arg', description='The term that is used for matching.

>  If Method is set to **char**, the value of this parameter must be ASCII strings. If Method is set to **hex**, the value of this parameter must be hexadecimal strings. Maximum length: 2,048.', example='test'),
                depth?: int32(name='Depth', description='The number of bytes from the start position for matching. Valid values: **1** to **2048**.', example='32'),
                position?: int32(name='Position', description='The start position for matching. Valid values: **0** to **2047**.', example='0'),
              }
            ](name='ConditionList', description='The match conditions.'),
            limited?: int32(name='Limited', description='The minimum number of bytes in a session to trigger matching. Valid values: **0** to **2048**.', example='0'),
            match?: string(name='Match', description='The condition based on which an action is performed. Valid values:

*   **0**: If the rule is matched, the action specified in the rule is performed.
*   **1**: If the rule is not matched, the action specified in the rule is performed.', example='1'),
            method?: string(name='Method', description='The type of the rule. Valid values:

*   **char**: string match.
*   **hex**: hexadecimal string match.', example='char'),
            name?: string(name='Name', description='The name of the rule.', example='test**'),
            priority?: int32(name='Priority', description='The priority of the rule.', example='1'),
          }
        ](name='L4RuleList', description='The port-specific mitigation rules.'),
        portRuleList?: [ 
          {
            dstPortEnd?: int32(name='DstPortEnd', description='The end of the destination port range. Valid values: **0** to **65535**.', example='65535'),
            dstPortStart?: int32(name='DstPortStart', description='The start of the destination port range. Valid values: **0** to **65535**.', example='0'),
            id?: string(name='Id', description='The ID of the rule.', example='8f3c3062-6c20-425d-8405-2bd1********'),
            matchAction?: string(name='MatchAction', description='The action triggered if the rule is matched. Valid value:

*   **drop**: The traffic is discarded.', example='drop'),
            protocol?: string(name='Protocol', description='The protocol type. Valid values:

*   **tcp**
*   **udp**', example='udp'),
            seqNo?: int32(name='SeqNo', description='The sequence number that indicates the order for the rule to take effect. The value is an integer.', example='1'),
            srcPortEnd?: int32(name='SrcPortEnd', description='The end of the source port range. Valid values: **0** to **65535**.', example='65535'),
            srcPortStart?: int32(name='SrcPortStart', description='The start of the source port range. Valid values: **0** to **65535**.', example='0'),
          }
        ](name='PortRuleList', description='The port blocking rules.'),
        reflectBlockUdpPortList?: [ int32 ](name='ReflectBlockUdpPortList', description='The ports whose traffic is filtered out by the filtering policies for UDP reflection attacks.'),
        regionBlockCountryList?: [ int32 ](name='RegionBlockCountryList', description='The countries in the location blacklist.'),
        regionBlockProvinceList?: [ int32 ](name='RegionBlockProvinceList', description='The provinces in the location blacklist.'),
        sourceBlockList?: [ 
          {
            blockExpireSeconds?: int32(name='BlockExpireSeconds', description='The validity period of the blacklist to which the source IP address is added. Unit: seconds.', example='120'),
            everySeconds?: int32(name='EverySeconds', description='The statistical period during which the system collects data on source IP addresses to determine whether to add the source IP addresses to the blacklist. Unit: seconds.', example='60'),
            exceedLimitTimes?: int32(name='ExceedLimitTimes', description='The number of times that the source IP address exceeds a limit in a statistical period.', example='5'),
            type?: int32(name='Type', description='The type of the source rate limit. Valid values:

*   **3**: the PPS limit on source IP addresses.
*   **4**: the bandwidth limit on source IP addresses.
*   **5**: the PPS limit on source SYN packets.
*   **6**: the bandwidth limit on source SYN packets.', example='3'),
          }
        ](name='SourceBlockList', description='The source IP addresses that are added to the blacklist.'),
        sourceLimit?: {
          bps?: int32(name='Bps', description='The bandwidth limit on source IP addresses. Unit: bytes per second.', example='2048'),
          pps?: int32(name='Pps', description='The packets per second (PPS) limit on source IP addresses.', example='64'),
          synBps?: int32(name='SynBps', description='The bandwidth limit on source SYN packets. Unit: bytes per second.', example='2048'),
          synPps?: int32(name='SynPps', description='The PPS limit on source SYN packets.', example='64'),
        }(name='SourceLimit', description='The settings for source rate limiting.'),
        whitenGfbrNets?: boolean(name='WhitenGfbrNets', description='Indicates whether back-to-origin CIDR blocks of Anti-DDoS Proxy are added to the whitelist.', example='false'),
      }(name='Content', description='The content of the policy.'),
      id?: string(name='Id', description='The ID of the policy.', example='877afbdf-3982-4d36-9886-f043********'),
      name?: string(name='Name', description='The name of the policy.', example='test**'),
      remark?: string(name='Remark', description='The remarks of the policy.', example='test'),
      type?: string(name='Type', description='The type of the policy. Valid values:

*   **default**: the default mitigation policy.
*   **l3**: IP-specific mitigation policies.
*   **l4**: port-specific mitigation policies.', example='l3'),
    }
  ](name='PolicyList', description='The policies.'),
  requestId?: string(name='RequestId', description='The request ID.', example='B4B379C2-9319-4C6B-B579-FE36831B09F4'),
  total?: long(name='Total', description='The total number of policies.', example='10'),
}

model ListPolicyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListPolicyResponseBody(name='body'),
}

/**
 * @summary Queries mitigation policies.
 *
 * @param request ListPolicyRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListPolicyResponse
 */
async function listPolicyWithOptions(request: ListPolicyRequest, runtime: Util.RuntimeOptions): ListPolicyResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.pageNo)) {
    query['PageNo'] = request.pageNo;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.productType)) {
    query['ProductType'] = request.productType;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListPolicy',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries mitigation policies.
 *
 * @param request ListPolicyRequest
 * @return ListPolicyResponse
 */
async function listPolicy(request: ListPolicyRequest): ListPolicyResponse {
  var runtime = new Util.RuntimeOptions{};
  return listPolicyWithOptions(request, runtime);
}

model ListPolicyAttachmentRequest {
  ipPortProtocolList?: [ 
    {
      ip?: string(name='Ip', description='The IP address of the protected object.

This parameter is required.', example='47.118.172.***'),
      port?: int32(name='Port', description='The port number of the protected object.', example='8*'),
      protocol?: string(name='Protocol', description='The protocol type of the protected object. Valid values:

*   **tcp**
*   **udp**', example='tcp'),
    }
  ](name='IpPortProtocolList', description='The protected objects.'),
  pageNo?: long(name='PageNo', description='The page number.', example='1'),
  pageSize?: long(name='PageSize', description='The number of entries per page. Default value: **10**.', example='10'),
  policyId?: string(name='PolicyId', description='The ID of the policy.', example='f38f6520-92b7-451e-b520-9ab3********'),
  policyType?: string(name='PolicyType', description='The type of the policy. Valid values:

*   **default**: the default mitigation policies.
*   **l3**: IP-specific mitigation policies.
*   **l4**: port-specific mitigation policies.', example='l3'),
}

model ListPolicyAttachmentShrinkRequest {
  ipPortProtocolListShrink?: string(name='IpPortProtocolList', description='The protected objects.'),
  pageNo?: long(name='PageNo', description='The page number.', example='1'),
  pageSize?: long(name='PageSize', description='The number of entries per page. Default value: **10**.', example='10'),
  policyId?: string(name='PolicyId', description='The ID of the policy.', example='f38f6520-92b7-451e-b520-9ab3********'),
  policyType?: string(name='PolicyType', description='The type of the policy. Valid values:

*   **default**: the default mitigation policies.
*   **l3**: IP-specific mitigation policies.
*   **l4**: port-specific mitigation policies.', example='l3'),
}

model ListPolicyAttachmentResponseBody = {
  attachmentList?: [ 
    {
      ip?: string(name='Ip', description='The IP address of the protected object.', example='147.139.183.***'),
      memberUid?: string(name='MemberUid', description='The UID of the member to which the IP address of the protected object belongs.', example='177699790631****'),
      policyId?: string(name='PolicyId', description='The ID of the policy.', example='1b43f44e-65e1-411a-b0c0-d6c1********'),
      policyName?: string(name='PolicyName', description='The name of the rule.', example='test**'),
      policyRemark?: string(name='PolicyRemark', description='The description of the policy.', example='test'),
      policyType?: string(name='PolicyType', description='The type of the policy. Valid values:

*   **l3**: IP-specific mitigation policies.
*   **l4**: port-specific mitigation policies.', example='l3'),
      port?: int32(name='Port', description='The port number of the protected object.', example='8*'),
      protocol?: string(name='Protocol', description='The protocol type of the protected object. Valid values:

*   **tcp**
*   **udp**', example='udp'),
      region?: string(name='Region', description='The region to which the IP address of the protected object belongs.', example='cn-hangzhou'),
    }
  ](name='AttachmentList', description='The records of attachments to the mitigation policy.'),
  requestId?: string(name='RequestId', description='The request ID.', example='B4B379C2-9319-4C6B-B579-FE36831B09F4'),
  total?: long(name='Total', description='The total number of attachments to the mitigation policy.', example='28'),
}

model ListPolicyAttachmentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListPolicyAttachmentResponseBody(name='body'),
}

/**
 * @summary Queries attachments to mitigation policies.
 *
 * @param tmpReq ListPolicyAttachmentRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListPolicyAttachmentResponse
 */
async function listPolicyAttachmentWithOptions(tmpReq: ListPolicyAttachmentRequest, runtime: Util.RuntimeOptions): ListPolicyAttachmentResponse {
  Util.validateModel(tmpReq);
  var request = new ListPolicyAttachmentShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.ipPortProtocolList)) {
    request.ipPortProtocolListShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.ipPortProtocolList, 'IpPortProtocolList', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.ipPortProtocolListShrink)) {
    query['IpPortProtocolList'] = request.ipPortProtocolListShrink;
  }
  if (!Util.isUnset(request.pageNo)) {
    query['PageNo'] = request.pageNo;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.policyId)) {
    query['PolicyId'] = request.policyId;
  }
  if (!Util.isUnset(request.policyType)) {
    query['PolicyType'] = request.policyType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListPolicyAttachment',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries attachments to mitigation policies.
 *
 * @param request ListPolicyAttachmentRequest
 * @return ListPolicyAttachmentResponse
 */
async function listPolicyAttachment(request: ListPolicyAttachmentRequest): ListPolicyAttachmentResponse {
  var runtime = new Util.RuntimeOptions{};
  return listPolicyAttachmentWithOptions(request, runtime);
}

model ListTagKeysRequest {
  currentPage?: int32(name='CurrentPage', description='The page number. Pages start from page **1**. Default value: **1**.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Valid values: 1 to **50**. Default value: **10**.', example='20'),
  regionId?: string(name='RegionId', description='The ID of the region that you want to query.

This parameter is required.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The resource group ID.', example='test'),
  resourceType?: string(name='ResourceType', description='The resource type. Set the value to **INSTANCE**.

This parameter is required.', example='INSTANCE'),
}

model ListTagKeysResponseBody = {
  currentPage?: int32(name='CurrentPage', description='The page number.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.', example='20'),
  requestId?: string(name='RequestId', description='The request ID.', example='97935DF1-0289-4AA2-9DD1-72377838B16B'),
  tagKeys?: [ 
    {
      tagCount?: int32(name='TagCount', description='The total number of tag values that correspond to each key.', example='1'),
      tagKey?: string(name='TagKey', description='The tag key.', example='a'),
    }
  ](name='TagKeys', description='The information about the tags.'),
  totalCount?: int32(name='TotalCount', description='The total number of tags returned.', example='6'),
}

model ListTagKeysResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTagKeysResponseBody(name='body'),
}

/**
 * @summary Queries all tags.
 *
 * @param request ListTagKeysRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTagKeysResponse
 */
async function listTagKeysWithOptions(request: ListTagKeysRequest, runtime: Util.RuntimeOptions): ListTagKeysResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.currentPage)) {
    query['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTagKeys',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries all tags.
 *
 * @param request ListTagKeysRequest
 * @return ListTagKeysResponse
 */
async function listTagKeys(request: ListTagKeysRequest): ListTagKeysResponse {
  var runtime = new Util.RuntimeOptions{};
  return listTagKeysWithOptions(request, runtime);
}

model ListTagResourcesRequest {
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results. You do not need to specify this parameter for the first request. You must specify the token that is obtained from the previous query as the value of **NextToken**.', example='RGuYpqDdKhzXb8C3.D1BwQgc1tMBsoxdGiEKHHUUCf****'),
  regionId?: string(name='RegionId', description='The ID of the region where the Anti-DDoS Origin instance resides.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/118703.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the Anti-DDoS Origin instance belongs in Resource Management.

If you do not specify this parameter, the instance belongs to the default resource group.', example='rg-acfm2pz25js****'),
  resourceId?: [ string ](name='ResourceId', description='The IDs of the Anti-DDoS Origin instances to query.

>  The **ResourceId** parameter and the **key-value pair for the Tag parameter** cannot be left empty at the same time.', example='ddosbgp-cn-v0h1fmwbc024'),
  resourceType?: string(name='ResourceType', description='The type of the resource to query. Set the value to **INSTANCE**.

This parameter is required.', example='INSTANCE'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of the tag to query.

>  The **ResourceId** parameter and the **key-value pair for the Tag parameter** cannot be left empty at the same time.', example='testKey1'),
      value?: string(name='Value', description='The value of the tag to query.

>  The **ResourceId** parameter and the **key-value pair for the Tag parameter** cannot be left empty at the same time.', example='testValue1'),
    }
  ](name='Tag', description='The key-value pair of the tag to query.'),
}

model ListTagResourcesResponseBody = {
  nextToken?: string(name='NextToken', description='A pagination token.', example='RGuYpqDdKhzXb8C3.D1BwQgc1tMBsoxdGiEKHHUUCf****'),
  requestId?: string(name='RequestId', description='The request ID.', example='C3F7E6AE-43B2-4730-B6A3-FD17552B8F65'),
  tagResources?: {
    tagResource?: [ 
    {
      resourceId?: string(name='ResourceId', description='The ID of the Anti-DDoS Origin instance.', example='ddosbgp-cn-n6w1r7nz****'),
      resourceType?: string(name='ResourceType', description='The type of the resource. The value is set to **INSTANCE**.', example='INSTANCE'),
      tagKey?: string(name='TagKey', description='The key of the tag that is added to the instance.', example='testKey1'),
      tagValue?: string(name='TagValue', description='The value of the tag that is added to the instance.', example='testValue1'),
    }
  ](name='TagResource')
  }(name='TagResources', description='The tags that are added to the Anti-DDoS Origin instance.'),
}

model ListTagResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTagResourcesResponseBody(name='body'),
}

/**
 * @summary Queries the relationship between Anti-DDoS Origin instances and tags.
 *
 * @description You can call the ListTagResources operation to query the tags that are added to Anti-DDoS Origin instances at a time.
 * ### [](#qps-)Limits
 * You can call this API operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ListTagResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTagResourcesResponse
 */
async function listTagResourcesWithOptions(request: ListTagResourcesRequest, runtime: Util.RuntimeOptions): ListTagResourcesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTagResources',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the relationship between Anti-DDoS Origin instances and tags.
 *
 * @description You can call the ListTagResources operation to query the tags that are added to Anti-DDoS Origin instances at a time.
 * ### [](#qps-)Limits
 * You can call this API operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ListTagResourcesRequest
 * @return ListTagResourcesResponse
 */
async function listTagResources(request: ListTagResourcesRequest): ListTagResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listTagResourcesWithOptions(request, runtime);
}

model ModifyPolicyRequest {
  actionType?: int32(name='ActionType', description='The type of the action. Valid values:

*   **10**: modifies the name. If you specify this value, `Name` is required.
*   **11**: modifies the blacklist validity period. If you specify this value, `BlackIpListExpireAt` is required. Only IP-specific mitigation policies support this value.
*   **12**: changes the status of the feature of adding back-to-origin CIDR blocks of Anti-DDoS Proxy to the whitelist. If you specify this value, `WhitenGfbrNets` is required. Only IP-specific mitigation policies support this value.
*   **13**: changes the status of the ICMP blocking feature. If you specify this value, `EnableDropIcmp` is required. Only IP-specific mitigation policies support this value.
*   **20**: adds IP addresses to the blacklist or the whitelist. If you specify this value, you must specify at least one of `WhiteIpList` and `BlackIpList`. Only IP-specific mitigation policies support this value.
*   **21**: removes IP addresses from the blacklist or the whitelist. If you specify this value, at least one of `WhiteIpList` and `BlackIpList` is required. Only IP-specific mitigation policies support this value.
*   **22**: clears the whitelist. Only IP-specific mitigation policies support this value.
*   **23**: clears the blacklist. Only IP-specific mitigation policies support this value.
*   **30**: modifies the status and level of intelligent protection. If you specify this value, `EnableIntelligence` and `IntelligenceLevel` are required. Only IP-specific mitigation policies support this value.
*   **31**: modifies the location blacklist settings. If you specify this value, one of `RegionBlockCountryList` and `RegionBlockProvinceList` is required. Only IP-specific mitigation policies support this value.
*   **32**: modifies the settings for source rate limiting. If you specify this value, `SourceLimit` and `SourceBlockList` are required. Only IP-specific mitigation policies support this value.
*   **33**: modifies the settings for reflection attack filtering. If you specify this value, `ReflectBlockUdpPortList` is required. Only IP-specific mitigation policies support this value.
*   **40**: creates a port blocking rule. If you specify this value, `PortRuleList` is required. Only IP-specific mitigation policies support this value.
*   **41**: modifies the port blocking rule. If you specify this value, `PortRuleList` is required. Only IP-specific mitigation policies support this value.
*   **42**: deletes the port blocking rule. If you specify this value, `PortRuleList` is required. Only IP-specific mitigation policies support this value.
*   **50**: creates a byte-match filter rule. If you specify this value, `FingerPrintRuleList` is required. Only IP-specific mitigation policies support this value.
*   **51**: modifies the byte-match filter rule. If you specify this value, `FingerPrintRuleList` is required. Only IP-specific mitigation policies support this value.
*   **52**: deletes the byte-match filter rule. If you specify this value, `FingerPrintRuleList` is required. Only IP-specific mitigation policies support this value.
*   **60**: changes the status of the port-specific mitigation feature. If you specify this value, `EnableL4Defense` is required. Only port-specific mitigation policies support this value.
*   **61**: creates a port-specific mitigation rule. If you specify this value, `L4RuleList` is required. Only port-specific mitigation policies support this value.
*   **62**: modifies the port-specific mitigation rule. If you specify this value, `L4RuleList` is required. Only port-specific mitigation policies support this value.
*   **63**: deletes the port-specific mitigation rule. If you specify this value, `L4RuleList` is required. Only port-specific mitigation policies support this value.

This parameter is required.', example='11'),
  content?: {
    blackIpList?: [ string ](name='BlackIpList', description='The IP addresses in the blacklist.'),
    blackIpListExpireAt?: long(name='BlackIpListExpireAt', description='The validity period of the IP address blacklist. The value is a UNIX timestamp.', example='1716878000'),
    enableDropIcmp?: boolean(name='EnableDropIcmp', description='Specifies whether to enable ICMP blocking.', example='true'),
    enableIntelligence?: boolean(name='EnableIntelligence', description='Specifies whether to enable intelligent protection.', example='true'),
    enableL4Defense?: boolean(name='EnableL4Defense', description='Specifies whether to enable port-specific mitigation.', example='true'),
    fingerPrintRuleList?: [ 
      {
        dstPortEnd?: int32(name='DstPortEnd', description='The end of the destination port range. Valid values: **0** to **65535**.

This parameter is required.', example='65535'),
        dstPortStart?: int32(name='DstPortStart', description='The start of the destination port range. Valid values: **0** to **65535**.

This parameter is required.', example='0'),
        id?: string(name='Id', description='The ID of the rule.', example='5fbe941f-a0cf-4a49-9c7c-8fac********'),
        matchAction?: string(name='MatchAction', description='The action triggered if the rule is matched. Valid values:

*   **accept**: allows the traffic that matches the conditions in the byte-match filter rule.
*   **drop**: discards the traffic that matches the conditions in the byte-match filter rule.
*   **ip_rate**: limits rates on the source IP address whose traffic matches the conditions in the byte-match filter rule. The rate limit is specified by **RateValue**.
*   **session_rate**: limits the number of sessions from the source IP address whose traffic matches the conditions in the byte-match filter rule. The rate limit is specified by **RateValue**.

This parameter is required.', example='drop'),
        maxPktLen?: int32(name='MaxPktLen', description='The maximum packet length. Valid values: **1** to **1500**.

This parameter is required.', example='1500'),
        minPktLen?: int32(name='MinPktLen', description='The minimum packet length. Valid values: **1** to **1500**.

This parameter is required.', example='1'),
        offset?: int32(name='Offset', description='The offset. Valid values: **0** to **1500**.', example='0'),
        payloadBytes?: string(name='PayloadBytes', description='The payload. The value is a hexadecimal string.', example='abcd'),
        protocol?: string(name='Protocol', description='The type of the protocol. Valid values:

*   **tcp**
*   **udp**

This parameter is required.', example='udp'),
        rateValue?: int32(name='RateValue', description='The rate limit. Valid values: **1** to **100000**.

>  This parameter is required when **MatchAction** is set to **ip_rate** or **session_rate**.', example='100'),
        seqNo?: int32(name='SeqNo', description='The sequence number that indicates the order for the rule to take effect. The value is an integer.

>  A smaller number indicates a higher priority.

This parameter is required.', example='1'),
        srcPortEnd?: int32(name='SrcPortEnd', description='The end of the source port range. Valid values: **0** to **65535**.

This parameter is required.', example='65535'),
        srcPortStart?: int32(name='SrcPortStart', description='The start of the source port range. Valid values: **0** to **65535**.

This parameter is required.', example='0'),
      }
    ](name='FingerPrintRuleList', description='The byte-match filter rules.'),
    intelligenceLevel?: string(name='IntelligenceLevel', description='The level of intelligent protection. Valid values:

*   **default**: normal.
*   **hard**: strict.
*   **weak**: loose.', example='default'),
    l4RuleList?: [ 
      {
        action?: string(name='Action', description='The action that is specified in the rule. Valid value:

*   **2**: The traffic is discarded.

This parameter is required.', example='2'),
        conditionList?: [ 
          {
            arg?: string(name='Arg', description='The term that is used for matching.

>  If Method is set to **char**, the value of this parameter must be ASCII strings. If Method is set to **hex**, the value of this parameter must be hexadecimal strings. Maximum length: 2,048.

This parameter is required.', example='abcd'),
            depth?: int32(name='Depth', description='The number of bytes from the start position for matching. Valid values: **1** to **2048**.

This parameter is required.', example='1200'),
            position?: int32(name='Position', description='The start position for matching. Valid values: **0** to **2047**.

This parameter is required.', example='0'),
          }
        ](name='ConditionList', description='The match conditions.

This parameter is required.'),
        limited?: int32(name='Limited', description='The minimum number of bytes in a session to trigger matching. Valid values: **0** to **2048**.

This parameter is required.', example='0'),
        match?: string(name='Match', description='The condition based on which an action is performed. Valid values:

*   **0**: If the rule is matched, the action specified in the rule is performed.
*   **1**: If the rule is not matched, the action specified in the rule is performed.

This parameter is required.', example='0'),
        method?: string(name='Method', description='The type of the rule. Valid values:

*   **char**: string match.
*   **hex**: hexadecimal string match.

This parameter is required.', example='char'),
        name?: string(name='Name', description='The name of the rule.

This parameter is required.', example='test****'),
        priority?: int32(name='Priority', description='The priority of the rule. Valid values: **1** to **100**.

>  A smaller value indicates a higher priority.

This parameter is required.', example='1'),
      }
    ](name='L4RuleList', description='The port-specific mitigation rules.'),
    portRuleList?: [ 
      {
        dstPortEnd?: int32(name='DstPortEnd', description='The end of the destination port range. Valid values: **0** to **65535**.

This parameter is required.', example='65535'),
        dstPortStart?: int32(name='DstPortStart', description='The start of the destination port range. Valid values: **0** to **65535**.

This parameter is required.', example='0'),
        id?: string(name='Id', description='The ID of the rule.', example='c52c2fa6-fdac-40c4-8753-be7c*********'),
        matchAction?: string(name='MatchAction', description='The action triggered if the rule is matched. Valid values:

*   **drop**: The traffic is discarded.

This parameter is required.', example='drop'),
        protocol?: string(name='Protocol', description='The type of the protocol. Valid values:

*   **tcp**
*   **udp**

This parameter is required.', example='tcp'),
        seqNo?: int32(name='SeqNo', description='The sequence number that indicates the order for the rule to take effect. The value is an integer.

>  A smaller number indicates a higher priority.

This parameter is required.', example='1'),
        srcPortEnd?: int32(name='SrcPortEnd', description='The end of the source port range. Valid values: **0** to **65535**.

This parameter is required.', example='65535'),
        srcPortStart?: int32(name='SrcPortStart', description='The start of the source port range. Valid values: **0** to **65535**.

This parameter is required.', example='0'),
      }
    ](name='PortRuleList', description='The port blocking rules.'),
    reflectBlockUdpPortList?: [ int32 ](name='ReflectBlockUdpPortList', description='The ports whose traffic is filtered out by the filtering policies for UDP reflection attacks.'),
    regionBlockCountryList?: [ int32 ](name='RegionBlockCountryList', description='The countries in the location blacklist.'),
    regionBlockProvinceList?: [ int32 ](name='RegionBlockProvinceList', description='The provinces in the location blacklist.'),
    sourceBlockList?: [ 
      {
        blockExpireSeconds?: int32(name='BlockExpireSeconds', description='The validity period of the blacklist to which the source IP address is added. Unit: seconds.

This parameter is required.', example='120'),
        everySeconds?: int32(name='EverySeconds', description='The statistical period during which the system collects data on source IP addresses to determine whether to add the source IP addresses to the blacklist. Unit: seconds.

This parameter is required.', example='60'),
        exceedLimitTimes?: int32(name='ExceedLimitTimes', description='The number of times that the source IP address exceeds a limit in a statistical period.

This parameter is required.', example='5'),
        type?: int32(name='Type', description='The type of the source rate limit. Valid values:

*   **3**: the pps limit on source IP addresses.
*   **4**: the bandwidth limit on source IP addresses.
*   **5**: the pps limit on source SYN packets.
*   **6**: the bandwidth limit on source SYN packets.

This parameter is required.', example='3'),
      }
    ](name='SourceBlockList', description='The source IP addresses that are added to the blacklist.'),
    sourceLimit?: {
      bps?: int32(name='Bps', description='The bandwidth limit on source IP addresses. Unit: bytes per second.', example='2048'),
      pps?: int32(name='Pps', description='The packets per second (pps) limit on source IP addresses.', example='64'),
      synBps?: int32(name='SynBps', description='The bandwidth limit on source SYN packets. Unit: bytes per second.', example='2048'),
      synPps?: int32(name='SynPps', description='The pps limit on source SYN packets.', example='64'),
    }(name='SourceLimit', description='The settings for source rate limiting.'),
    whiteIpList?: [ string ](name='WhiteIpList', description='The IP addresses in the whitelist.'),
    whitenGfbrNets?: boolean(name='WhitenGfbrNets', description='Specifies whether to add back-to-origin CIDR blocks of Anti-DDoS Proxy to the whitelist.', example='false'),
  }(name='Content', description='The policy content.'),
  id?: string(name='Id', description='The ID of the policy.

This parameter is required.', example='c52c2fa6-fdac-40c4-8753-be7c********'),
  name?: string(name='Name', description='The name of the policy.', example='demo**'),
}

model ModifyPolicyShrinkRequest {
  actionType?: int32(name='ActionType', description='The type of the action. Valid values:

*   **10**: modifies the name. If you specify this value, `Name` is required.
*   **11**: modifies the blacklist validity period. If you specify this value, `BlackIpListExpireAt` is required. Only IP-specific mitigation policies support this value.
*   **12**: changes the status of the feature of adding back-to-origin CIDR blocks of Anti-DDoS Proxy to the whitelist. If you specify this value, `WhitenGfbrNets` is required. Only IP-specific mitigation policies support this value.
*   **13**: changes the status of the ICMP blocking feature. If you specify this value, `EnableDropIcmp` is required. Only IP-specific mitigation policies support this value.
*   **20**: adds IP addresses to the blacklist or the whitelist. If you specify this value, you must specify at least one of `WhiteIpList` and `BlackIpList`. Only IP-specific mitigation policies support this value.
*   **21**: removes IP addresses from the blacklist or the whitelist. If you specify this value, at least one of `WhiteIpList` and `BlackIpList` is required. Only IP-specific mitigation policies support this value.
*   **22**: clears the whitelist. Only IP-specific mitigation policies support this value.
*   **23**: clears the blacklist. Only IP-specific mitigation policies support this value.
*   **30**: modifies the status and level of intelligent protection. If you specify this value, `EnableIntelligence` and `IntelligenceLevel` are required. Only IP-specific mitigation policies support this value.
*   **31**: modifies the location blacklist settings. If you specify this value, one of `RegionBlockCountryList` and `RegionBlockProvinceList` is required. Only IP-specific mitigation policies support this value.
*   **32**: modifies the settings for source rate limiting. If you specify this value, `SourceLimit` and `SourceBlockList` are required. Only IP-specific mitigation policies support this value.
*   **33**: modifies the settings for reflection attack filtering. If you specify this value, `ReflectBlockUdpPortList` is required. Only IP-specific mitigation policies support this value.
*   **40**: creates a port blocking rule. If you specify this value, `PortRuleList` is required. Only IP-specific mitigation policies support this value.
*   **41**: modifies the port blocking rule. If you specify this value, `PortRuleList` is required. Only IP-specific mitigation policies support this value.
*   **42**: deletes the port blocking rule. If you specify this value, `PortRuleList` is required. Only IP-specific mitigation policies support this value.
*   **50**: creates a byte-match filter rule. If you specify this value, `FingerPrintRuleList` is required. Only IP-specific mitigation policies support this value.
*   **51**: modifies the byte-match filter rule. If you specify this value, `FingerPrintRuleList` is required. Only IP-specific mitigation policies support this value.
*   **52**: deletes the byte-match filter rule. If you specify this value, `FingerPrintRuleList` is required. Only IP-specific mitigation policies support this value.
*   **60**: changes the status of the port-specific mitigation feature. If you specify this value, `EnableL4Defense` is required. Only port-specific mitigation policies support this value.
*   **61**: creates a port-specific mitigation rule. If you specify this value, `L4RuleList` is required. Only port-specific mitigation policies support this value.
*   **62**: modifies the port-specific mitigation rule. If you specify this value, `L4RuleList` is required. Only port-specific mitigation policies support this value.
*   **63**: deletes the port-specific mitigation rule. If you specify this value, `L4RuleList` is required. Only port-specific mitigation policies support this value.

This parameter is required.', example='11'),
  contentShrink?: string(name='Content', description='The policy content.'),
  id?: string(name='Id', description='The ID of the policy.

This parameter is required.', example='c52c2fa6-fdac-40c4-8753-be7c********'),
  name?: string(name='Name', description='The name of the policy.', example='demo**'),
}

model ModifyPolicyResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='B4B379C2-9319-4C6B-B579-FE36831****'),
}

model ModifyPolicyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyPolicyResponseBody(name='body'),
}

/**
 * @summary Modifies a mitigation policy.
 *
 * @description Modifies a mitigation policy.
 *
 * @param tmpReq ModifyPolicyRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyPolicyResponse
 */
async function modifyPolicyWithOptions(tmpReq: ModifyPolicyRequest, runtime: Util.RuntimeOptions): ModifyPolicyResponse {
  Util.validateModel(tmpReq);
  var request = new ModifyPolicyShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.content)) {
    request.contentShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.content, 'Content', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.actionType)) {
    query['ActionType'] = request.actionType;
  }
  if (!Util.isUnset(request.contentShrink)) {
    query['Content'] = request.contentShrink;
  }
  if (!Util.isUnset(request.id)) {
    query['Id'] = request.id;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyPolicy',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies a mitigation policy.
 *
 * @description Modifies a mitigation policy.
 *
 * @param request ModifyPolicyRequest
 * @return ModifyPolicyResponse
 */
async function modifyPolicy(request: ModifyPolicyRequest): ModifyPolicyResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyPolicyWithOptions(request, runtime);
}

model ModifyPolicyContentRequest {
  content?: {
    blackIpListExpireAt?: long(name='BlackIpListExpireAt', description='The validity period of the IP address blacklist. The value is a UNIX timestamp.', example='1716878000'),
    enableDropIcmp?: boolean(name='EnableDropIcmp', description='Specifies whether to enable ICMP blocking.', example='true'),
    enableIntelligence?: boolean(name='EnableIntelligence', description='Specifies whether to enable intelligent protection.', example='true'),
    enableL4Defense?: boolean(name='EnableL4Defense', description='Specifies whether to enable port-specific mitigation.', example='true'),
    fingerPrintRuleList?: [ 
      {
        dstPortEnd?: int32(name='DstPortEnd', description='The end of the destination port range. Valid values: **0** to **65535**.

This parameter is required.', example='65535'),
        dstPortStart?: int32(name='DstPortStart', description='The start of the destination port range. Valid values: **0** to **65535**.

This parameter is required.', example='0'),
        id?: string(name='Id', description='The ID of the rule.', example='83967609-7ea5-4f6d-a6ea-380b09e****'),
        matchAction?: string(name='MatchAction', description='The action triggered if the rule is matched. Valid values:

*   **permit**: allows the traffic that matches the conditions in the byte-match filter rule.
*   **drop**: discards the traffic that matches the conditions in the byte-match filter rule.
*   **ip_rate**: limits rates on the source IP address whose traffic matches the conditions in the byte-match filter rule. The rate limit is specified by **RateValue**.
*   **session_rate**: limits the number of sessions from the source IP address whose traffic matches the conditions in the byte-match filter rule. The rate limit is specified by **RateValue**.

This parameter is required.', example='drop'),
        maxPktLen?: int32(name='MaxPktLen', description='The maximum packet length. Valid values: **1** to **1500**.

This parameter is required.', example='1500'),
        minPktLen?: int32(name='MinPktLen', description='The minimum packet length. Valid values: **1** to **1500**.

This parameter is required.', example='1'),
        offset?: int32(name='Offset', description='The offset. Valid values: **0** to **1500**.', example='0'),
        payloadBytes?: string(name='PayloadBytes', description='The payload. The value is a hexadecimal string.', example='abcd'),
        protocol?: string(name='Protocol', description='The protocol type. Valid values:

*   **tcp**
*   **udp**

This parameter is required.', example='tcp'),
        rateValue?: int32(name='RateValue', description='The rate limit. Valid values: **1** to **100000**.

>  This parameter is required when **MatchAction** is set to **ip_rate** or **session_rate**.', example='100'),
        seqNo?: int32(name='SeqNo', description='The sequence number that indicates the order for the rule to take effect. The value is an integer.

>  A smaller number indicates a higher priority.

This parameter is required.', example='1'),
        srcPortEnd?: int32(name='SrcPortEnd', description='The end of the source port range. Valid values: **0** to **65535**.

This parameter is required.', example='65535'),
        srcPortStart?: int32(name='SrcPortStart', description='The start of the source port range. Valid values: **0** to **65535**.

This parameter is required.', example='0'),
      }
    ](name='FingerPrintRuleList', description='The byte-match filter rules.'),
    intelligenceLevel?: string(name='IntelligenceLevel', description='The level of intelligent protection. Valid values:

*   **default**: normal.
*   **hard**: strict.
*   **weak**: loose.', example='default'),
    l4RuleList?: [ 
      {
        action?: string(name='Action', description='The action that is specified in the rule. Valid value:

*   **2**: The traffic is discarded.

This parameter is required.', example='2'),
        conditionList?: [ 
          {
            arg?: string(name='Arg', description='The term that is used for matching.

>  If Method is set to **char**, the value of this parameter must be ASCII strings. If Method is set to **hex**, the value of this parameter must be hexadecimal strings. Maximum length: 2,048.

This parameter is required.', example='abcd'),
            depth?: int32(name='Depth', description='The number of bytes from the start position for matching. Valid values: **1** to **2048**.

This parameter is required.', example='1200'),
            position?: int32(name='Position', description='The start position for matching. Valid values: **0** to **2047**.

This parameter is required.', example='0'),
          }
        ](name='ConditionList', description='The match conditions.

This parameter is required.'),
        limited?: int32(name='Limited', description='The minimum number of bytes in a session to trigger matching. Valid values: **0** to **2048**.

This parameter is required.', example='0'),
        match?: string(name='Match', description='The condition based on which an action is performed. Valid values:

*   **0**: If the rule is matched, the action specified in the rule is performed.
*   **1**: If the rule is not matched, the action specified in the rule is performed.

This parameter is required.', example='0'),
        method?: string(name='Method', description='The type of the rule. Valid values:

*   **char**: string match.
*   **hex**: hexadecimal string match.

This parameter is required.', example='char'),
        name?: string(name='Name', description='The name of the rule.

This parameter is required.', example='test**'),
        priority?: int32(name='Priority', description='The priority of the rule. Valid values: 1 to 100.

>  A smaller value indicates a higher priority.

This parameter is required.', example='1'),
      }
    ](name='L4RuleList', description='The port-specific mitigation rules.'),
    portRuleList?: [ 
      {
        dstPortEnd?: int32(name='DstPortEnd', description='The end of the destination port range. Valid values: **0** to **65535**.

This parameter is required.', example='65535'),
        dstPortStart?: int32(name='DstPortStart', description='The start of the destination port range. Valid values: **0** to **65535**.

This parameter is required.', example='0'),
        id?: string(name='Id', description='The ID of the rule.', example='412a7312-58ff-4e32-a202-0ab0*******'),
        matchAction?: string(name='MatchAction', description='The action triggered if the rule is matched. Valid values:

*   **drop**: The traffic is discarded.

This parameter is required.', example='drop'),
        protocol?: string(name='Protocol', description='The protocol type. Valid values:

*   **tcp**
*   **udp**

This parameter is required.', example='tcp'),
        seqNo?: int32(name='SeqNo', description='The sequence number that indicates the order for the rule to take effect. The value is an integer.

>  A smaller number indicates a higher priority.

This parameter is required.', example='1'),
        srcPortEnd?: int32(name='SrcPortEnd', description='The end of the source port range. Valid values: **0** to **65535**.

This parameter is required.', example='65535'),
        srcPortStart?: int32(name='SrcPortStart', description='The start of the source port range. Valid values: **0** to **65535**.

This parameter is required.', example='0'),
      }
    ](name='PortRuleList', description='The port blocking rules.'),
    reflectBlockUdpPortList?: [ int32 ](name='ReflectBlockUdpPortList', description='The ports whose traffic is filtered out by the filtering policies for UDP reflection attacks.'),
    regionBlockCountryList?: [ int32 ](name='RegionBlockCountryList', description='The countries in the location blacklist.'),
    regionBlockProvinceList?: [ int32 ](name='RegionBlockProvinceList', description='The provinces in the location blacklist.'),
    sourceBlockList?: [ 
      {
        blockExpireSeconds?: int32(name='BlockExpireSeconds', description='The validity period of the blacklist to which the source IP address is added. Unit: seconds.

This parameter is required.', example='120'),
        everySeconds?: int32(name='EverySeconds', description='The statistical period during which the system collects data on source IP addresses to determine whether to add the source IP addresses to the blacklist. Unit: seconds.

This parameter is required.', example='60'),
        exceedLimitTimes?: int32(name='ExceedLimitTimes', description='The number of times that the source IP address exceeds a limit in a statistical period.

This parameter is required.', example='5'),
        type?: int32(name='Type', description='The type of the source rate limit. Valid values:

*   **3**: the pps limit on source IP addresses.
*   **4**: the bandwidth limit on source IP addresses.
*   **5**: the pps limit on source SYN packets.
*   **6**: the bandwidth limit on source SYN packets.

This parameter is required.', example='3'),
      }
    ](name='SourceBlockList', description='The source IP addresses that are added to the blacklist.'),
    sourceLimit?: {
      bps?: int32(name='Bps', description='The bandwidth limit on source IP addresses. Unit: bytes per second.', example='2048'),
      pps?: int32(name='Pps', description='The packets per second (pps) limit on source IP addresses.', example='64'),
      synBps?: int32(name='SynBps', description='The bandwidth limit on source SYN packets. Unit: bytes per second.', example='2048'),
      synPps?: int32(name='SynPps', description='The pps limit on source SYN packets.', example='64'),
    }(name='SourceLimit', description='The settings for source rate limiting.'),
    whitenGfbrNets?: boolean(name='WhitenGfbrNets', description='Specifies whether to add back-to-origin CIDR blocks of Anti-DDoS Proxy to the whitelist.', example='false'),
  }(name='Content', description='The policy content.'),
  id?: string(name='Id', description='The ID of the policy.

This parameter is required.', example='83967609-7ea5-4f6d-a6ea-380b09e****'),
  name?: string(name='Name', description='The name of the policy.', example='demo**'),
}

model ModifyPolicyContentShrinkRequest {
  contentShrink?: string(name='Content', description='The policy content.'),
  id?: string(name='Id', description='The ID of the policy.

This parameter is required.', example='83967609-7ea5-4f6d-a6ea-380b09e****'),
  name?: string(name='Name', description='The name of the policy.', example='demo**'),
}

model ModifyPolicyContentResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='3777EF25-940B-51F4-BB1D-99B5********'),
}

model ModifyPolicyContentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyPolicyContentResponseBody(name='body'),
}

/**
 * @summary Modifies the content of the mitigation policy.
 *
 * @description Make sure that all request parameters are configured when you call this operation. If any parameter is left empty, the configuration is deleted.
 *
 * @param tmpReq ModifyPolicyContentRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyPolicyContentResponse
 */
async function modifyPolicyContentWithOptions(tmpReq: ModifyPolicyContentRequest, runtime: Util.RuntimeOptions): ModifyPolicyContentResponse {
  Util.validateModel(tmpReq);
  var request = new ModifyPolicyContentShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.content)) {
    request.contentShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.content, 'Content', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.contentShrink)) {
    query['Content'] = request.contentShrink;
  }
  if (!Util.isUnset(request.id)) {
    query['Id'] = request.id;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyPolicyContent',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the content of the mitigation policy.
 *
 * @description Make sure that all request parameters are configured when you call this operation. If any parameter is left empty, the configuration is deleted.
 *
 * @param request ModifyPolicyContentRequest
 * @return ModifyPolicyContentResponse
 */
async function modifyPolicyContent(request: ModifyPolicyContentRequest): ModifyPolicyContentResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyPolicyContentWithOptions(request, runtime);
}

model ModifyRemarkRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Anti-DDoS Origin instance for which you want to add remarks.

>  You can call the [DescribeInstanceList](https://help.aliyun.com/document_detail/118698.html) operation to query the IDs of all Anti-DDoS Origin instances.

This parameter is required.', example='ddosbgp-cn-n6w1r7nz****'),
  regionId?: string(name='RegionId', description='The ID of the region where the Anti-DDoS Origin instance resides.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/118703.html) operation to query the most recent region list.', example='cn-hangzhou'),
  remark?: string(name='Remark', description='The remarks for the Anti-DDoS Origin instance.

This parameter is required.', example='test-remark'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the Anti-DDoS Origin instance belongs in Resource Management.

If you do not specify this parameter, the instance belongs to the default resource group.', example='rg-acfm2pz25js****'),
}

model ModifyRemarkResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='6AC3597B-7FD5-5E68-97C3-E11F4D010732'),
}

model ModifyRemarkResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyRemarkResponseBody(name='body'),
}

/**
 * @summary Adds remarks for a single Anti-DDoS Origin instance.
 *
 * @description You can call the ModifyRemark operation to add remarks for a single Anti-DDoS Origin instance.
 * ### [](#qps-)Limits
 * You can call this operation up to 10 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ModifyRemarkRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyRemarkResponse
 */
async function modifyRemarkWithOptions(request: ModifyRemarkRequest, runtime: Util.RuntimeOptions): ModifyRemarkResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.remark)) {
    query['Remark'] = request.remark;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyRemark',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Adds remarks for a single Anti-DDoS Origin instance.
 *
 * @description You can call the ModifyRemark operation to add remarks for a single Anti-DDoS Origin instance.
 * ### [](#qps-)Limits
 * You can call this operation up to 10 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ModifyRemarkRequest
 * @return ModifyRemarkResponse
 */
async function modifyRemark(request: ModifyRemarkRequest): ModifyRemarkResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyRemarkWithOptions(request, runtime);
}

model MoveResourceGroupRequest {
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which you want to move the resource.

This parameter is required.', example='rg-acfm3peow3k****'),
  resourceId?: string(name='ResourceId', description='The resource ID.

This parameter is required.', example='ddos_originpre_public_cn-7213kxxxxx'),
  resourceRegionId?: string(name='ResourceRegionId', description='The region ID of the resource.

This parameter is required.', example='cn-hangzhou'),
  resourceType?: string(name='ResourceType', description='The resource type. Set the value to **instance**.

This parameter is required.', example='instance'),
}

model MoveResourceGroupResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='16A78396-936F-5481-91D7-591BF7981246'),
}

model MoveResourceGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: MoveResourceGroupResponseBody(name='body'),
}

/**
 * @summary Changes the resource group to which a cloud resource belongs.
 *
 * @param request MoveResourceGroupRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return MoveResourceGroupResponse
 */
async function moveResourceGroupWithOptions(request: MoveResourceGroupRequest, runtime: Util.RuntimeOptions): MoveResourceGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceRegionId)) {
    query['ResourceRegionId'] = request.resourceRegionId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'MoveResourceGroup',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Changes the resource group to which a cloud resource belongs.
 *
 * @param request MoveResourceGroupRequest
 * @return MoveResourceGroupResponse
 */
async function moveResourceGroup(request: MoveResourceGroupRequest): MoveResourceGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return moveResourceGroupWithOptions(request, runtime);
}

model QuerySchedruleOnDemandRequest {
  instanceId?: string(name='InstanceId', description='The ID of the on-demand instance.

>  You can call the [DescribeOnDemandInstance](https://help.aliyun.com/document_detail/152120.html) operation to query the IDs of all on-demand instances.

This parameter is required.', example='ddosbgp-cn-z2q1qzxb****'),
  regionId?: string(name='RegionId', description='The region ID of the on-demand instance.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/118703.html) operation to query the most recent region list.', example='cn-zhangjiakou'),
}

model QuerySchedruleOnDemandResponseBody = {
  instanceId?: string(name='InstanceId', description='The ID of the on-demand instance.', example='ddosbgp-cn-z2q1qzxb****'),
  requestId?: string(name='RequestId', description='The request ID.', example='4A8F9980-5ACB-497F-9F15-48E9D6B29028'),
  ruleConfig?: [ 
    {
      ruleAction?: string(name='RuleAction', description='The scheduling action. The value is set to **declare**, which indicates that the route is advertised.', example='declare'),
      ruleConditionCnt?: string(name='RuleConditionCnt', description='If the inbound bandwidth or packets consecutively exceed the threshold for the specified number of times, the scheduling rule is triggered and traffic is rerouted to the on-demand instance. The specified number of times is the value of this parameter.

>  The threshold of inbound bandwidth is the value of **RuleConditionMbps**. The threshold of inbound packets is the value of **RuleConditionKpps**.', example='3'),
      ruleConditionKpps?: string(name='RuleConditionKpps', description='The threshold of inbound packets. Unit: kilo packets per second (Kpps). Minimum value: **10**.', example='10'),
      ruleConditionMbps?: string(name='RuleConditionMbps', description='The threshold of inbound bandwidth. Unit: Mbit/s. Minimum value: **100**.', example='100'),
      ruleName?: string(name='RuleName', description='The name of the scheduling rule.', example='ddosbgp-cn-z2q1qzxb****'),
      ruleSwitch?: string(name='RuleSwitch', description='Indicates whether the scheduling rule is enabled. Valid values:

*   **on**: enabled.
*   **off**: disabled.', example='on'),
      ruleUndoBeginTime?: string(name='RuleUndoBeginTime', description='The start time of the period during which the scheduling rule is automatically stopped. The time must be in the 24-hour clock and in the `hh:mm` format.

If the system detects that DDoS attacks stop, the system no longer reroutes traffic to the on-demand instance from the time you specified. We recommend that you set this parameter to a value that is defined as off-peak hours.

>  This parameter takes effect only when the value of **RuleUndoMode** is **auto**.', example='03:00'),
      ruleUndoEndTime?: string(name='RuleUndoEndTime', description='The end time of the period during which the scheduling rule is automatically stopped. The time must be in the 24-hour clock and in the `hh:mm` format.', example='03:05'),
      ruleUndoMode?: string(name='RuleUndoMode', description='The stop method of the scheduling rule. Valid values:

*   **auto**
*   **manual**', example='auto'),
      timeZone?: string(name='TimeZone', description='The time zone of the time when the scheduling rule automatically stops. The time zone must be in the `GMT-hh:mm` format.

For example, the value `GMT-08:00` indicates that the time zone is UTC+8.

>  This parameter takes effect only when the value of **RuleUndoMode** is **auto**.', example='GMT-08:00'),
    }
  ](name='RuleConfig', description='The configurations of the scheduling rule.'),
  ruleStatus?: [ 
    {
      net?: string(name='Net', description='The CIDR block of the on-demand instance.', example='47.***.***.0/24'),
      ruleSchedStatus?: string(name='RuleSchedStatus', description='The scheduling status. Valid values:

*   **scheduled**
*   **unscheduled**', example='unscheduled'),
    }
  ](name='RuleStatus', description='The status of the scheduling rule.'),
  userId?: string(name='UserId', description='The ID of the Alibaba Cloud account.', example='171986973287****'),
}

model QuerySchedruleOnDemandResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QuerySchedruleOnDemandResponseBody(name='body'),
}

/**
 * @summary Queries the scheduling rule of an anti-DDoS diversion instance.
 *
 * @param request QuerySchedruleOnDemandRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return QuerySchedruleOnDemandResponse
 */
async function querySchedruleOnDemandWithOptions(request: QuerySchedruleOnDemandRequest, runtime: Util.RuntimeOptions): QuerySchedruleOnDemandResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QuerySchedruleOnDemand',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the scheduling rule of an anti-DDoS diversion instance.
 *
 * @param request QuerySchedruleOnDemandRequest
 * @return QuerySchedruleOnDemandResponse
 */
async function querySchedruleOnDemand(request: QuerySchedruleOnDemandRequest): QuerySchedruleOnDemandResponse {
  var runtime = new Util.RuntimeOptions{};
  return querySchedruleOnDemandWithOptions(request, runtime);
}

model ReleaseDdosOriginInstanceRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Anti-DDoS Origin instance that you want to release.

>  You can call the [DescribeInstanceList](https://help.aliyun.com/document_detail/118698.html) operation to query the IDs of all Anti-DDoS Origin instances.

This parameter is required.', example='ddosorigin_cn-pe335v7gs01'),
}

model ReleaseDdosOriginInstanceResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='B4B379C2-9319-4C6B-B579-FE36831B09F4'),
}

model ReleaseDdosOriginInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ReleaseDdosOriginInstanceResponseBody(name='body'),
}

/**
 * @summary Releases a pay-as-you-go Anti-DDoS Origin instance.
 *
 * @param request ReleaseDdosOriginInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ReleaseDdosOriginInstanceResponse
 */
async function releaseDdosOriginInstanceWithOptions(request: ReleaseDdosOriginInstanceRequest, runtime: Util.RuntimeOptions): ReleaseDdosOriginInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ReleaseDdosOriginInstance',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Releases a pay-as-you-go Anti-DDoS Origin instance.
 *
 * @param request ReleaseDdosOriginInstanceRequest
 * @return ReleaseDdosOriginInstanceResponse
 */
async function releaseDdosOriginInstance(request: ReleaseDdosOriginInstanceRequest): ReleaseDdosOriginInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return releaseDdosOriginInstanceWithOptions(request, runtime);
}

model SetInstanceModeOnDemandRequest {
  instanceIdList?: [ string ](name='InstanceIdList', description='The IDs of on-demand instances.

> You can call the [DescribeOnDemandInstance](https://help.aliyun.com/document_detail/152120.html) operation to query the IDs of all on-demand instances.

This parameter is required.', example='ddosbgp-cn-z2q1qzxb****'),
  mode?: string(name='Mode', description='Specifies the scheduling mode for on-demand instances. Valid values:

*   **manual**: manual scheduling
*   **netflow-auto**: automatic scheduling

This parameter is required.', example='netflow-auto'),
  regionId?: string(name='RegionId', description='The region ID of the on-demand instance.

> You can call the [DescribeRegions](https://help.aliyun.com/document_detail/118703.html) operation to query all regions that are supported by Anti-DDoS Origin.', example='cn-zhangjiakou'),
}

model SetInstanceModeOnDemandResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='BD06F539-2FBE-450D-9391-7EFF787128F5'),
}

model SetInstanceModeOnDemandResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SetInstanceModeOnDemandResponseBody(name='body'),
}

/**
 * @summary Specifies the scheduling mode for on-demand instances.
 *
 * @param request SetInstanceModeOnDemandRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SetInstanceModeOnDemandResponse
 */
async function setInstanceModeOnDemandWithOptions(request: SetInstanceModeOnDemandRequest, runtime: Util.RuntimeOptions): SetInstanceModeOnDemandResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceIdList)) {
    query['InstanceIdList'] = request.instanceIdList;
  }
  if (!Util.isUnset(request.mode)) {
    query['Mode'] = request.mode;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SetInstanceModeOnDemand',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Specifies the scheduling mode for on-demand instances.
 *
 * @param request SetInstanceModeOnDemandRequest
 * @return SetInstanceModeOnDemandResponse
 */
async function setInstanceModeOnDemand(request: SetInstanceModeOnDemandRequest): SetInstanceModeOnDemandResponse {
  var runtime = new Util.RuntimeOptions{};
  return setInstanceModeOnDemandWithOptions(request, runtime);
}

model TagResourcesRequest {
  regionId?: string(name='RegionId', description='The ID of the region in which the instance resides.

> You can call the [DescribeRegions](https://help.aliyun.com/document_detail/118703.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the instance belongs in Resource Management.

If you do not specify this parameter, the instance belongs to the default resource group.', example='rg-acfm2pz25js****'),
  resourceId?: [ string ](name='ResourceId', description='The IDs of the instances to which you want to add tags. You can specify up to 51 IDs.

This parameter is required.', example='ddosbgp-cn-v0h1fmwb****'),
  resourceType?: string(name='ResourceType', description='The type of the resource to which you want to add tags. Set the value to **INSTANCE**, which indicates instances.

This parameter is required.', example='INSTANCE'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of the tag to add.

> If the specified key does not exist, a key is created.', example='test-key'),
      value?: string(name='Value', description='The value of the tag to add.

> If the specified tag value does not exist, the tag value is created.', example='test-value'),
    }
  ](name='Tag', description='The tags to add. You can specify up to 21 tags.'),
}

model TagResourcesResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='7078CD1E-F609-47A4-9C39-B288CC27C686'),
}

model TagResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: TagResourcesResponseBody(name='body'),
}

/**
 * @summary Add tags to Anti-DDoS Origin instances.
 *
 * @description You can call the TagResources operation to add tags to instances.
 * ### Limit
 * You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request TagResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return TagResourcesResponse
 */
async function tagResourcesWithOptions(request: TagResourcesRequest, runtime: Util.RuntimeOptions): TagResourcesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'TagResources',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Add tags to Anti-DDoS Origin instances.
 *
 * @description You can call the TagResources operation to add tags to instances.
 * ### Limit
 * You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request TagResourcesRequest
 * @return TagResourcesResponse
 */
async function tagResources(request: TagResourcesRequest): TagResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return tagResourcesWithOptions(request, runtime);
}

model UntagResourcesRequest {
  all?: boolean(name='All', description='Specifies whether to remove all tags from the instances. Default value: No.', example='false'),
  regionId?: string(name='RegionId', description='The ID of the region in which the instances reside.

This parameter is required.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group.', example='test'),
  resourceId?: [ string ](name='ResourceId', description='The IDs of the instances. Valid values of N: 0 to 49. You can specify up to 50 instances at a time. Example: ResourceId.0, ResourceId.1, ... , ResourceId.49.

This parameter is required.', example='ddosbgp-cn-v0h1fmwbc024'),
  resourceType?: string(name='ResourceType', description='The resource type. Set the value to **INSTANCE**.

This parameter is required.', example='INSTANCE'),
  tagKey?: [ string ](name='TagKey', description='The keys of the tag that you want to remove. Valid values of N: 0 to 19. You can specify up to 20 tag keys at a time. Example: Tag.0.Key, Tag.1.Key, ... , Tag.19.Key.', example='testKey1'),
}

model UntagResourcesResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='F2D86AED-BA27-4584-BADC-B43BDA7EEBCA'),
}

model UntagResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UntagResourcesResponseBody(name='body'),
}

/**
 * @summary Removes tags from Anti-DDoS Origin instances.
 *
 * @param request UntagResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UntagResourcesResponse
 */
async function untagResourcesWithOptions(request: UntagResourcesRequest, runtime: Util.RuntimeOptions): UntagResourcesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.all)) {
    query['All'] = request.all;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.tagKey)) {
    query['TagKey'] = request.tagKey;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UntagResources',
    version = '2018-07-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Removes tags from Anti-DDoS Origin instances.
 *
 * @param request UntagResourcesRequest
 * @return UntagResourcesResponse
 */
async function untagResources(request: UntagResourcesRequest): UntagResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return untagResourcesWithOptions(request, runtime);
}

